import store from "@/store";
import { useSystemStore } from "@/store/system";
const systemStore = useSystemStore(store);
export const setFontSize = (initSize?: number) => {
//基准大小
const baseSize = initSize || 16;
let screenWidth;
const mediaQueryList = window.matchMedia("(orientation: landscape)");
if (mediaQueryList.matches) {
// 横屏
screenWidth = 812;
systemStore.setLandscape(true);
} else {
// 竖屏
screenWidth = 375;
systemStore.setLandscape(false);
}
const scale = document.documentElement.clientWidth / screenWidth;
//设置页面根节点字体大小, 字体大小最小为10
let fontSize =
baseSize * Math.min(scale, 2) > 10 ? baseSize * Math.min(scale, 2) : 10;
return fontSize + "px";
}
Pinia之在js文件中使用store(个人笔记)
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。
推荐阅读更多精彩内容
- import store from "@/store";import useUserStore from "@/s...
- 前言 在新建的js文件中想用store里面的数据,比如token想在封装的axios里面,请求头里面去使用,亦或者...
- 向HTML文件中插入js就要使用<script>标签。 <script>标签六个属性 有两种应用方式:html页面...
- SwiftUI Xcode教程之在 iOS 中使用Schemes 和 .xcconfig 文件来组织构建交付 很多...
- 1、.DS_Store文件介绍 .DS_Store 是 Finder 用来存储这个文件夹的显示属性的:比如文件图标...
