From 51ba2672d153c172b6bc4d62f3df0edc8f621870 Mon Sep 17 00:00:00 2001
From: 罗广辉 <guanghui.luo@foxmail.com>
Date: Thu, 26 Jun 2025 18:02:06 +0800
Subject: [PATCH] feat: 样式自适应
---
src/main.js | 3 +++
src/styles/variables.scss | 4 ++++
2 files changed, 7 insertions(+), 0 deletions(-)
diff --git a/src/main.js b/src/main.js
index e24d589..7b16e6f 100644
--- a/src/main.js
+++ b/src/main.js
@@ -95,6 +95,9 @@
app.config.globalProperties.$dayjs = dayjs
app.config.globalProperties.website = website
app.config.globalProperties.getScreen = getScreen
+app.config.globalProperties.pxToVh = height => height / 10.8 + 'vh'
+app.config.globalProperties.pxToRem = width => width * 0.1 + 'rem'
+
app.use(error)
app.use(i18n)
app.use(store)
diff --git a/src/styles/variables.scss b/src/styles/variables.scss
index ef29df7..8c395ec 100644
--- a/src/styles/variables.scss
+++ b/src/styles/variables.scss
@@ -1,3 +1,7 @@
$sidebar_width: 230px;
$sidebar_collapse: 60px;
$top_height: 50px;
+
+@function pxToVh($px) {
+ @return calc($px / 1080) * 100vh;
+}
--
Gitblit v1.9.3