Browse Source
refactor(字体缩放): 重构字体缩放功能并优化样式管理
refactor(字体缩放): 重构字体缩放功能并优化样式管理
将字体缩放功能从App.vue迁移至各页面组件,确保字体比例在页面显示时正确应用 添加text.scss样式文件集中管理字体大小变量 优化useHeight工具函数计算逻辑,增加对tabbar高度的考虑 统一将getmyareaApi重命名为getMyAreaApi以符合命名规范 移除多个组件中不再需要的uni.scss导入master
13 changed files with 306 additions and 63 deletions
-
27App.vue
-
2components/custom-tab-bar/my-tab-bar.vue
-
4components/nav/nav.vue
-
2libs/api/index.js
-
27libs/utils/index.js
-
4pages/allDish/allDish.vue
-
11pages/home/home.vue
-
3pages/index/index.vue
-
11pages/login/login.vue
-
2pages/personalInformation/personalInformation.vue
-
160pages/shoppingCart/shoppingCart.vue
-
57static/text.scss
-
59uni.scss
@ -1,23 +1,16 @@ |
|||||
<script> |
|
||||
import useStore from "@/store"; |
|
||||
|
<script setup> |
||||
|
import { onLaunch } from "@dcloudio/uni-app"; |
||||
|
|
||||
export default { |
|
||||
onLaunch() { |
|
||||
// console.log("App Launch"); |
|
||||
const store = useStore(); |
|
||||
store.fontScale = uni.getStorageSync("fontScale") || 1; |
|
||||
}, |
|
||||
onShow() { |
|
||||
// console.log("App Show"); |
|
||||
}, |
|
||||
onHide() { |
|
||||
const store = useStore(); |
|
||||
uni.setStorageSync("fontScale", store.fontScale); |
|
||||
}, |
|
||||
}; |
|
||||
|
onLaunch(() => { |
||||
|
console.log("onLaunch!!!"); |
||||
|
}); |
||||
</script> |
</script> |
||||
|
|
||||
|
<style lang="scss" scoped> |
||||
|
@import './uni.scss'; |
||||
|
</style> |
||||
|
|
||||
<style> |
<style> |
||||
/*每个页面公共css */ |
|
||||
|
/* @import '@/static/text.scss'; */ |
||||
@import "@/static/icon/iconfont.css"; |
@import "@/static/icon/iconfont.css"; |
||||
</style> |
</style> |
||||
@ -0,0 +1,57 @@ |
|||||
|
$text-ss: calc(var(--font-scale, 1) * 12rpx); |
||||
|
$text-xs: calc(var(--font-scale, 1) * 20rpx); |
||||
|
$text-sm: calc(var(--font-scale, 1) * 22rpx); |
||||
|
$text-base: calc(var(--font-scale, 1) * 24rpx); |
||||
|
$text-lg: calc(var(--font-scale, 1) * 26rpx); |
||||
|
$text-xl: calc(var(--font-scale, 1) * 28rpx); |
||||
|
$text-2xl: calc(var(--font-scale, 1) * 30rpx); |
||||
|
$text-3xl: calc(var(--font-scale, 1) * 32rpx); |
||||
|
$text-4xl: calc(var(--font-scale, 1) * 34rpx); |
||||
|
$text-5xl: calc(var(--font-scale, 1) * 36rpx); |
||||
|
$text-6xl: calc(var(--font-scale, 1) * 38rpx); |
||||
|
$text-7xl: calc(var(--font-scale, 1) * 40rpx); |
||||
|
$text-8xl: calc(var(--font-scale, 1) * 42rpx); |
||||
|
$text-9xl: calc(var(--font-scale, 1) * 44rpx); |
||||
|
|
||||
|
.text-ss { |
||||
|
font-size: $text-ss; |
||||
|
} |
||||
|
.text-xs { |
||||
|
font-size: $text-xs; |
||||
|
} |
||||
|
.text-sm { |
||||
|
font-size: $text-sm; |
||||
|
} |
||||
|
.text-base { |
||||
|
font-size: $text-base; |
||||
|
} |
||||
|
.text-lg { |
||||
|
font-size: $text-lg; |
||||
|
} |
||||
|
.text-xl { |
||||
|
font-size: $text-xl; |
||||
|
} |
||||
|
.text-2xl { |
||||
|
font-size: $text-2xl; |
||||
|
} |
||||
|
.text-3xl { |
||||
|
font-size: $text-3xl; |
||||
|
} |
||||
|
.text-4xl { |
||||
|
font-size: $text-4xl; |
||||
|
} |
||||
|
.text-5xl { |
||||
|
font-size: $text-5xl; |
||||
|
} |
||||
|
.text-6xl { |
||||
|
font-size: $text-6xl; |
||||
|
} |
||||
|
.text-7xl { |
||||
|
font-size: $text-7xl; |
||||
|
} |
||||
|
.text-8xl { |
||||
|
font-size: $text-8xl; |
||||
|
} |
||||
|
.text-9xl { |
||||
|
font-size: $text-9xl; |
||||
|
} |
||||
Write
Preview
Loading…
Cancel
Save
Reference in new issue