Explorar o código

pinia 替换 vuex

CzRger hai 1 ano
pai
achega
4178e0abc9

+ 3 - 6
index.html

@@ -4,13 +4,10 @@
     <meta charset="UTF-8" />
     <meta name="viewport" content="width=device-width, initial-scale=1.0" />
     <title>唐山政务服务</title>
-  <!-- 在 head 标签中添加 meta 标签,并设置 viewport-fit=cover 值 -->
-  <meta
-          name="viewport"
-          content="width=device-width, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0, viewport-fit=cover"
-  />
+    <!-- 在 head 标签中添加 meta 标签,并设置 viewport-fit=cover 值 -->
+    <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0, viewport-fit=cover"/>
   </head>
-  <body>
+  <body ontouchstart="">
     <div id="app"></div>
     <script type="module" src="/src/main.ts"></script>
   </body>

+ 3 - 2
package.json

@@ -13,6 +13,7 @@
     "axios": "^1.7.2",
     "default-passive-events": "^2.0.0",
     "fast-glob": "^3.3.2",
+    "pinia": "^2.1.7",
     "rollup-plugin-visualizer": "^5.12.0",
     "sass": "^1.77.8",
     "uuid": "^10.0.0",
@@ -23,11 +24,11 @@
     "vite-plugin-svg-icons": "^2.0.1",
     "vite-plugin-top-level-await": "^1.4.2",
     "vue": "^3.4.31",
-    "vue-router": "^4.4.0",
-    "vuex": "^4.1.0"
+    "vue-router": "^4.4.0"
   },
   "devDependencies": {
     "@vitejs/plugin-vue": "^5.0.5",
+    "postcss-px-to-viewport": "^1.1.1",
     "typescript": "^5.2.2",
     "vite": "^5.3.4",
     "vue-tsc": "^2.0.24"

+ 5 - 5
src/App.vue

@@ -1,9 +1,9 @@
 <template>
-  <!-- 开启顶部安全区适配 -->
-<!--  <van-nav-bar safe-area-inset-top />-->
-ass
-  <!-- 开启底部安全区适配 -->
-<!--  <van-number-keyboard safe-area-inset-bottom />-->
+  <van-config-provider>
+    <div style="overflow: hidden; width: 100%; height: 100%;">
+      <router-view/>
+    </div>
+  </van-config-provider>
 </template>
 
 <script setup lang="ts">

BIN=BIN
src/assets/images/menu/homebar.png


BIN=BIN
src/assets/images/menu/homebar_active.png


BIN=BIN
src/assets/images/menu/mapbar.png


BIN=BIN
src/assets/images/menu/mapbar_active.png


BIN=BIN
src/assets/images/menu/minebar.png


BIN=BIN
src/assets/images/menu/minebar_active.png


BIN=BIN
src/assets/images/menu/workbar.png


BIN=BIN
src/assets/images/menu/workbar_active.png


+ 53 - 0
src/components/SvgIcon/index.vue

@@ -0,0 +1,53 @@
+<template>
+  <svg aria-hidden="true" class="svg-icon" :style="`width: ${size}px;height: ${size}px;transform: rotate(${rotate}deg);`">
+    <use :xlink:href="symbolId" :fill="color" />
+  </svg>
+</template>
+
+
+<script lang="ts">
+  import {
+    defineComponent,
+    computed,
+  } from "vue";
+  export default defineComponent({
+    name: "SvgIcon",
+    components: {},
+    props: {
+      prefix: {
+        type: String,
+        default: 'icon'
+      },
+      name: {
+        type: String,
+        required: true
+      },
+      color: {
+        type: String,
+        default: ''
+      },
+      size: {
+        type: [Number, String],
+        default: '18'
+      },
+      rotate: {
+        type: [Number, String],
+        default: 0
+      }
+    },
+    setup(props, { emit }) {
+      const symbolId = computed(() => `#${props.prefix}-${props.name}`)
+      return {
+        symbolId
+      }
+    }
+  })
+</script>
+
+<style scoped>
+.svg-icon {
+  vertical-align: -0.15em;
+  overflow: hidden;
+  fill: currentColor;
+}
+</style>

+ 55 - 0
src/layout/index.vue

@@ -0,0 +1,55 @@
+<template>
+  <div class="layout">
+    <van-nav-bar
+      class="layout-title"
+      v-if="!$route.meta.noTitle"
+      :title="$route.meta.title"
+      right-text="回到首页"
+      left-arrow
+      @click-left="onRouterBack"
+      @click-right="onBackHome"
+    />
+
+    <RouterViewCom/>
+    <van-tabbar v-model="state.active" active-color="var(--cus-main-color)">
+      <template v-for="item in state.menuList">
+        <van-tabbar-item replace :to="item.path" :name="item.name">
+          <template #icon="props">
+            <img :src="props.active ? item.meta.menuActiveIcon : item.meta.menuIcon" />
+          </template>
+          {{ item.meta.title }}
+        </van-tabbar-item>
+      </template>
+    </van-tabbar>
+
+  </div>
+</template>
+
+<script setup lang="ts">
+import RouterViewCom from './router-view.vue'
+import {computed, getCurrentInstance, reactive} from "vue";
+import {useRouter, useRoute} from "vue-router";
+
+const {proxy} = getCurrentInstance()
+const router = useRouter()
+const route = useRoute()
+console.log(router.getRoutes())
+console.log(router.getRoutes().filter(v => v.meta?.isMenu))
+const state: any = reactive({
+  active: <any>0,
+  menuList: <any>router.getRoutes().filter(v => v.meta?.isMenu)
+})
+state.active = state.menuList.filter(v => v.name === route.name)[0].name
+const onRouterBack = () => {}
+const onBackHome = () => {}
+</script>
+
+<style lang="scss" scoped>
+:deep(.layout-title) {
+  background-color: var(--cus-main-color);
+  .van-nav-bar__title {
+    color: #ffffff;
+    font-size: 16px;
+  }
+}
+</style>

+ 0 - 2
src/layout/router-view.vue

@@ -21,14 +21,12 @@ import {
   toRefs,
   nextTick
 } from 'vue'
-import {useStore} from 'vuex'
 import {useRouter, useRoute} from 'vue-router'
 
 export default defineComponent({
   name: '',
   components: {},
   setup() {
-    const store = useStore();
     const router = useRouter();
     const route = useRoute();
     const that = (getCurrentInstance() as ComponentInternalInstance).appContext.config.globalProperties

+ 3 - 2
src/main.ts

@@ -1,7 +1,6 @@
 import { createApp } from 'vue'
 import App from './App.vue'
 import router, {initMainRouter} from './router'
-import store from "./store"
 import './style/index.scss'
 import 'virtual:svg-icons-register'    // 【svg-icons相关】
 import initComponent from '@/plugins/initComponent'
@@ -11,6 +10,8 @@ import initDirect from '@/plugins/initDirect'
 import 'default-passive-events'
 import './browerPatch'
 import Vant from 'vant';
+import 'vant/lib/index.css'
+import { createPinia } from 'pinia'
 
 
 repeatFileValid()
@@ -20,7 +21,7 @@ await initProperties(app)
 initComponent(app)
 app.use(initDirect)
 app.use(router)
-app.use(store)
+app.use(createPinia())
 app.use(Vant);
 app.mount('#app')
 // 设置为 true 以在浏览器开发工具的 performance/timeline 面板中启用对组件初始化、编译、渲染和更新的性能追踪。

+ 1 - 1
src/plugins/initComponent.ts

@@ -4,7 +4,7 @@ interface FileType {
 }
 
 // @ts-ignore
-const Components: Record<string, FileType> = import.meta.globEager("/src/components/**/*.vue")
+const Components: Record<string, FileType> = import.meta.glob('/src/components/**/*.vue', { eager: true })
 
 export default (app: App): void => {
   // 因为通过 import.meta.globEager 返回的列表不能迭代所以直接使用 Object.keys 拿到 key 遍历

+ 29 - 54
src/router/index.ts

@@ -1,6 +1,5 @@
 import {createRouter, createWebHistory} from 'vue-router'
 import staticRouter from './modules/static'
-import store from '@/store/index'
 import Temp404 from '@/views/global/temp/404.vue'
 import * as api from '@/api/index'
 import {toLogin} from "@/utils/permissions";
@@ -16,63 +15,39 @@ const router = createRouter({
 });
 
 router.beforeEach((to, from , next) => {
-    if (to.meta?.noAuth) {
-        if (to.path === '/login' && localStorage.getItem('ax_token')) {
-            next({
-                path: '/'
-            })
-        } else {
-            next()
-        }
-    } else {
-        if (to.query.axToken) {
-            localStorage.removeItem('navigations')
-            localStorage.removeItem('menuExpend')
-            localStorage.setItem("ax_token", <string>to.query.axToken);
-            setTimeout(() => {//虽然不知道为什么要加宏任务,但是我不敢改
-                delete to.query.axToken
-                let url = `${window.location.origin + window.location.pathname}?`
-                for (let queryKey in to.query) {
-                    url += `${queryKey}=${to.query[queryKey]}&`
-                }
-                window.location.replace(url.slice(0, url.length - 1));
-                getInit(to, next)
-            }, 0);
-        } else if (localStorage.getItem("ax_token")) {
-            getInit(to, next)
-        } else {
-            toLogin()
-        }
-    }
+    next()
+    // if (to.meta?.noAuth) {
+    //     if (to.path === '/login' && localStorage.getItem('ax_token')) {
+    //         next({
+    //             path: '/'
+    //         })
+    //     } else {
+    //         next()
+    //     }
+    // } else {
+    //     if (to.query.axToken) {
+    //         localStorage.removeItem('navigations')
+    //         localStorage.removeItem('menuExpend')
+    //         localStorage.setItem("ax_token", <string>to.query.axToken);
+    //         setTimeout(() => {//虽然不知道为什么要加宏任务,但是我不敢改
+    //             delete to.query.axToken
+    //             let url = `${window.location.origin + window.location.pathname}?`
+    //             for (let queryKey in to.query) {
+    //                 url += `${queryKey}=${to.query[queryKey]}&`
+    //             }
+    //             window.location.replace(url.slice(0, url.length - 1));
+    //             getInit(to, next)
+    //         }, 0);
+    //     } else if (localStorage.getItem("ax_token")) {
+    //         getInit(to, next)
+    //     } else {
+    //         toLogin()
+    //     }
+    // }
 })
 
-const getInit = (to: any, next: any) => {
-    document.title = to?.meta?.title || (import.meta as any).env.VITE_PROJECT_TITLE
-    if (to.path === '/') {
-        const firstRoute = store.state.menu.allRouters[0]
-        next({
-            path: firstRoute.redirect || firstRoute.path
-        })
-    } else {
-        next()
-    }
-}
 
 export const initMainRouter = async () => {
-    // 获取当前页面的 URL
-    const urlParams = new URLSearchParams(window.location.search);
-    // 获取名为 axToken 的参数值
-    const axToken = urlParams.get('axToken');
-    if (axToken) {
-        localStorage.setItem("ax_token", axToken);
-    }
-    if (localStorage.getItem("ax_token") && !['/path', '/find'].includes(location.pathname)) {
-        await Promise.all([
-            store.dispatch('app/LOAD_USER_INFO')
-        ]).then(async ([r, u]) => {
-
-        })
-    }
 
 }
 export default router;

+ 63 - 1
src/router/modules/static.ts

@@ -1,6 +1,68 @@
 import RouterViewCom from "@/layout/router-view.vue";
+import LayoutCom from '@/layout/index.vue'
+import homeBarImage from '@/assets/images/menu/homebar.png';
+import homeBarActiveImage from '@/assets/images/menu/homebar_active.png';
+import mapBarImage from '@/assets/images/menu/mapbar.png';
+import mapBarActiveImage from '@/assets/images/menu/mapbar_active.png';
+import workBarImage from '@/assets/images/menu/workbar.png';
+import workBarActiveImage from '@/assets/images/menu/workbar_active.png';
+import mineBarImage from '@/assets/images/menu/minebar.png';
+import mineBarActiveImage from '@/assets/images/menu/minebar_active.png';
+
 // 不需要菜单管理配置的路由
 const staticRouter = [
-
+  {
+    path: '/',
+    name: 'root', // 菜单根路由name标识
+    component: LayoutCom,
+    redirect: '/home',
+    children: [
+      {
+        path: 'home',
+        name: 'home',
+        component: () => import('@/views/home/index.vue'),
+        meta: {
+          title: '首页',
+          isMenu: true,
+          menuIcon: homeBarImage,
+          menuActiveIcon: homeBarActiveImage,
+          noTitle: true,
+        }
+      },
+      {
+        path: 'map',
+        name: 'map',
+        component: () => import('@/views/map/index.vue'),
+        meta: {
+          title: '政务地图',
+          isMenu: true,
+          menuIcon: mapBarImage,
+          menuActiveIcon: mapBarActiveImage
+        }
+      },
+      {
+        path: 'work',
+        name: 'work',
+        component: () => import('@/views/work/index.vue'),
+        meta: {
+          title: '我要办事',
+          isMenu: true,
+          menuIcon: workBarImage,
+          menuActiveIcon: workBarActiveImage
+        }
+      },
+      {
+        path: 'mine',
+        name: 'mine',
+        component: () => import('@/views/mine/index.vue'),
+        meta: {
+          title: '我的',
+          isMenu: true,
+          menuIcon: mineBarImage,
+          menuActiveIcon: mineBarActiveImage
+        }
+      },
+    ]
+  },
 ]
 export default staticRouter

+ 0 - 15
src/store/index.ts

@@ -1,15 +0,0 @@
-import { createStore } from "vuex";
-import app from "./modules/app";
-import dictionary from "./modules/dictionary";
-import regex from "./modules/regex";
-
-export default createStore({
-  state: <any>{},
-  mutations: {},
-  actions: {},
-  modules: {
-    app,
-    dictionary,
-    regex,
-  },
-});

+ 0 - 47
src/store/modules/app.ts

@@ -1,47 +0,0 @@
-import * as api from '@/api/index'
-import {getUserInfo} from "@/api/modules/global/global";
-
-const state = {
-	userInfo: <any>{},
-	permissions: [],
-}
-
-const getters = {
-}
-
-const mutations = {
-	SET_USER_INFO(state: any, data: object) {
-		state.userInfo = data
-	},
-	SET_PERMISSIONS(state: any, data: Array<string>) {
-		state.permissions = data
-	},
-}
-
-const actions = {
-	LOAD_USER_INFO({ commit }: any, refresh: boolean = false) {
-		return new Promise((resolve, reject) => {
-			if (refresh || !state.userInfo?.userId) {
-				getUserInfo().then((res: any) => {
-					if (res.code === 200) {
-						commit('SET_USER_INFO', res.user)
-						commit('SET_PERMISSIONS', res.permissions)
-						resolve(state.userInfo)
-					} else {
-						reject(res.msg)
-					}
-				})
-			} else {
-				resolve(state.userInfo)
-			}
-		})
-	},
-}
-
-export default {
-	namespaced: true,
-	state,
-	getters,
-	mutations,
-	actions
-}

+ 0 - 56
src/store/modules/dictionary.ts

@@ -1,56 +0,0 @@
-import * as api from '@/api/index'
-import { dictionary, dictionaryDefine } from './dictionary-define'
-import { dictionaryOther, dictionaryOtherDefine } from './dictionary-other-define'
-
-const state = {
-	...dictionary,
-	...dictionaryOther,
-}
-
-const mutations = {
-	SET_DICT_LIST(state: any, { listName, mapName, objMapName, data }: any) {
-		const map = new Map()
-		const objMap = new Map()
-		if (data.length > 0) {
-			data.forEach((v: any) => {
-				v.selectLabel = v.dictLabel
-				v.selectValue = v.dictValue
-				map.set(v.dictValue, v.dictLabel)
-				objMap.set(v.dictValue, v)
-			})
-		}
-		state[listName] = data
-		state[mapName] = map
-		state[objMapName] = objMap
-	},
-}
-
-const actions = {
-	LOAD_DICT_LIST({ commit }: any, type: any) {
-		return new Promise((resolve, reject) => {
-			if (state[dictionaryDefine[type][0]].length === 0) {
-				api.default.dicDeptDictList(type).then((res: any) => {
-					commit('SET_DICT_LIST', {
-						listName: dictionaryDefine[type][0],
-						mapName: dictionaryDefine[type][1],
-						objMapName: dictionaryDefine[type]?.[2],
-						data: res.data
-					})
-					resolve(res.data)
-				}).catch((e: any) => {
-					console.log('e: ', e);
-					reject('获取'+dictionaryDefine[type][0]+'字典错误')
-				})
-			} else {
-				resolve(state[dictionaryDefine[type][0]])
-			}
-		})
-	},
-}
-
-export default {
-	namespaced: true,
-	state,
-	mutations,
-	actions
-}

+ 0 - 31
src/store/modules/regex.ts

@@ -1,31 +0,0 @@
-const state = {
-  //  11位手机号 + 带区号座机号 + 不带区号座机 + 空格
-  phoneCN: /^(1[3-9]\d{9}|\d{3,4}-\d{7,8}|\d{7,8}|\s+)$/,
-  //  邮箱
-  email: /^[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*$/,
-  //  密码级别低(0):请输入8~16位密码
-  password0: /^.{8,16}$/,
-  //  密码级别中(1):请输入8~16位密码,要求同时包含大小写字母、数字
-  password1: /^(?=.*[a-z])(?=.*[A-Z])(?=.*\d).{8,16}$/,
-  //  密码级别高(2):请输入8~16位密码,要求同时包含大小写字母、数字、特殊字符
-  password2: /^(?=.*[a-z])(?=.*[A-Z])(?=.*\d)(?=.*[~!@#$%^&*()_+`\-={}[\]:;"'<>,.?/]).{8,16}$/,
-  // ip
-  ip: /^((2(5[0-5]|[0-4]\d))|[0-1]?\d{1,2})(\.((2(5[0-5]|[0-4]\d))|[0-1]?\d{1,2})){3}$/,
-}
-
-const getters = {
-}
-
-const mutations = {
-}
-
-const actions = {
-}
-
-export default {
-  namespaced: true,
-  state,
-  getters,
-  mutations,
-  actions
-}

src/store/modules/dictionary-define.ts → src/stores/dictionary-define.ts


src/store/modules/dictionary-other-define.ts → src/stores/dictionary-other-define.ts


+ 68 - 0
src/stores/dictionary.ts

@@ -0,0 +1,68 @@
+import * as api from '@/api/index'
+import { dictionary, dictionaryDefine } from './dictionary-define'
+import { dictionaryOther, dictionaryOtherDefine } from './dictionary-other-define'
+import { defineStore } from 'pinia'
+
+export const useDictionaryStore = defineStore('dictionary', {
+	state: () => ({
+		aaa: 123,
+		...dictionary,
+		...dictionaryOther,
+	}),
+	getters: {
+	},
+	actions: {
+
+	},
+})
+// const state = {
+//
+// }
+//
+// const mutations = {
+// 	SET_DICT_LIST(state: any, { listName, mapName, objMapName, data }: any) {
+// 		const map = new Map()
+// 		const objMap = new Map()
+// 		if (data.length > 0) {
+// 			data.forEach((v: any) => {
+// 				v.selectLabel = v.dictLabel
+// 				v.selectValue = v.dictValue
+// 				map.set(v.dictValue, v.dictLabel)
+// 				objMap.set(v.dictValue, v)
+// 			})
+// 		}
+// 		state[listName] = data
+// 		state[mapName] = map
+// 		state[objMapName] = objMap
+// 	},
+// }
+//
+// const actions = {
+// 	LOAD_DICT_LIST({ commit }: any, type: any) {
+// 		return new Promise((resolve, reject) => {
+// 			if (state[dictionaryDefine[type][0]].length === 0) {
+// 				api.default.dicDeptDictList(type).then((res: any) => {
+// 					commit('SET_DICT_LIST', {
+// 						listName: dictionaryDefine[type][0],
+// 						mapName: dictionaryDefine[type][1],
+// 						objMapName: dictionaryDefine[type]?.[2],
+// 						data: res.data
+// 					})
+// 					resolve(res.data)
+// 				}).catch((e: any) => {
+// 					console.log('e: ', e);
+// 					reject('获取'+dictionaryDefine[type][0]+'字典错误')
+// 				})
+// 			} else {
+// 				resolve(state[dictionaryDefine[type][0]])
+// 			}
+// 		})
+// 	},
+// }
+//
+// export default {
+// 	namespaced: true,
+// 	state,
+// 	mutations,
+// 	actions
+// }

+ 3 - 0
src/style/cus.scss

@@ -0,0 +1,3 @@
+:root {
+  --cus-main-color: #CE0022
+}

+ 1 - 0
src/style/index.scss

@@ -1,4 +1,5 @@
 @import './webkit-scrollbar';
+@import './cus';
 
 * {
   outline: none;  // dom元素选中带边框

+ 1 - 12
src/utils/permissions.ts

@@ -1,4 +1,3 @@
-import store from '@/store/index'
 
 //跳转登录
 export const toLogin = () => {
@@ -7,15 +6,5 @@ export const toLogin = () => {
 };
 
 export const has = (value: any) => {
-  const permissions = store.state.app.permissions;
-  let hasPermissions = null
-  if (value && value instanceof Array && value.length > 0) {
-    hasPermissions = permissions.some((p: string) => value.includes(p));
-  } else {
-    hasPermissions = permissions.includes(value)
-  }
-  if (hasPermissions) {
-    return true
-  }
-  return false
+
 }

+ 14 - 0
src/views/home/index.vue

@@ -0,0 +1,14 @@
+<template>
+首页{{$store}}
+</template>
+
+<script setup lang="ts">
+import {getCurrentInstance, reactive} from "vue";
+
+const {proxy} = getCurrentInstance()
+const state = reactive({
+})
+</script>
+
+<style lang="scss" scoped>
+</style>

+ 14 - 0
src/views/map/index.vue

@@ -0,0 +1,14 @@
+<template>
+政务地图
+</template>
+
+<script setup lang="ts">
+import {getCurrentInstance, reactive} from "vue";
+
+const {proxy} = getCurrentInstance()
+const state = reactive({
+})
+</script>
+
+<style lang="scss" scoped>
+</style>

+ 14 - 0
src/views/mine/index.vue

@@ -0,0 +1,14 @@
+<template>
+我的
+</template>
+
+<script setup lang="ts">
+import {getCurrentInstance, reactive} from "vue";
+
+const {proxy} = getCurrentInstance()
+const state = reactive({
+})
+</script>
+
+<style lang="scss" scoped>
+</style>

+ 14 - 0
src/views/work/index.vue

@@ -0,0 +1,14 @@
+<template>
+我要办事
+</template>
+
+<script setup lang="ts">
+import {getCurrentInstance, reactive} from "vue";
+
+const {proxy} = getCurrentInstance()
+const state = reactive({
+})
+</script>
+
+<style lang="scss" scoped>
+</style>

+ 27 - 1
vite.config.ts

@@ -6,6 +6,8 @@ import viteCompression from 'vite-plugin-compression';//Gzip
 import { visualizer } from "rollup-plugin-visualizer";
 import { createSvgIconsPlugin } from 'vite-plugin-svg-icons' // 【svg-icons相关】
 import VitePluginHtmlEnv from 'vite-plugin-html-env'
+import postcsspxtoviewport from 'postcss-px-to-viewport'
+
 
 const time = new Date().getTime()
 export default defineConfig({
@@ -47,7 +49,8 @@ export default defineConfig({
   },
   server: {
     port: 8090,
-    open: false,
+    host: '0.0.0.0',
+    open: true,
     strictPort: false,
     proxy: {
       '/mock-api': {
@@ -59,6 +62,29 @@ export default defineConfig({
       }
     }
   },
+  css: {
+    postcss: {
+      plugins: [
+        postcsspxtoviewport({
+          unitToConvert: 'px',
+          viewportWidth: 350,
+          unitPrecision: 5, // 单位转换后保留的精度
+          propList: ['*'], // 能转化为vw的属性列表
+          viewportUnit: 'vw', // 希望使用的视口单位
+          fontViewportUnit: 'vw', // 字体使用的视口单位
+          selectorBlackList: ['ignore-'], // 需要忽略的CSS选择器,不会转为视口单位,使用原有的px等单位。
+          minPixelValue: 1, // 设置最小的转换数值,如果为1的话,只有大于1的值会被转换
+          mediaQuery: true, // 媒体查询里的单位是否需要转换单位
+          replace: true, //  是否直接更换属性值,而不添加备用属性
+          exclude: [], // 忽略某些文件夹下的文件或特定文件,例如 'node_modules' 下的文件
+          include: [], // 如果设置了include,那将只有匹配到的文件才会被转换
+          landscape: false, // 是否添加根据 landscapeWidth 生成的媒体查询条件 @media (orientation: landscape)
+          landscapeUnit: 'vw', // 横屏时使用的单位
+          landscapeWidth: 1628, // 横屏时使用的视口宽度
+        }),
+      ]
+    }
+  },
   build: {
     outDir: "tszwfw-mobile",
     rollupOptions: {//分包优化

+ 32 - 18
yarn.lock

@@ -423,7 +423,7 @@
     "@vue/compiler-dom" "3.4.34"
     "@vue/shared" "3.4.34"
 
-"@vue/devtools-api@^6.0.0-beta.11", "@vue/devtools-api@^6.5.1":
+"@vue/devtools-api@^6.5.0", "@vue/devtools-api@^6.5.1":
   version "6.6.3"
   resolved "https://registry.npmmirror.com/@vue/devtools-api/-/devtools-api-6.6.3.tgz#b23a588154cba8986bba82b6e1d0248bde3fd1a0"
   integrity sha512-0MiMsFma/HqA6g3KLKn+AGpL1kgKhFWszC9U29NfpWK5LE7bjeXxySWJrOJ77hBz+TBrBQ7o4QJqbPbqbs8rJw==
@@ -1923,7 +1923,7 @@ nth-check@^2.0.1:
   dependencies:
     boolbase "^1.0.0"
 
-object-assign@^4, object-assign@^4.1.0:
+object-assign@>=4.0.1, object-assign@^4, object-assign@^4.1.0:
   version "4.1.1"
   resolved "https://registry.npmmirror.com/object-assign/-/object-assign-4.1.1.tgz#2109adc7965887cfc05cbbd442cac8bfbb360863"
   integrity sha512-rJgTQnkUnH1sFw8yT6VSU3zD3sWmu6sZhIseY8VX+GRu3P6F7Fu+JNDoXfklElbLJSnc3FUQHVe4cU5hj+BcUg==
@@ -2005,6 +2005,14 @@ picomatch@^2.0.4, picomatch@^2.2.1, picomatch@^2.3.1:
   resolved "https://registry.npmmirror.com/picomatch/-/picomatch-2.3.1.tgz#3ba3833733646d9d3e4995946c1365a67fb07a42"
   integrity sha512-JU3teHTNjmE2VCGFzuY8EXzCDVwEqB2a8fsIvwaStHhAWJEeVd1o1QD80CU6+ZdEXXSLbSsuLwJjkCBWqRQUVA==
 
+pinia@^2.1.7:
+  version "2.1.7"
+  resolved "https://registry.npmmirror.com/pinia/-/pinia-2.1.7.tgz#4cf5420d9324ca00b7b4984d3fbf693222115bbc"
+  integrity sha512-+C2AHFtcFqjPih0zpYuvof37SFxMQ7OEG2zV9jRI12i9BOy3YQVAHwdKtyyc8pDcDyIc33WCIsZaCFWU7WWxGQ==
+  dependencies:
+    "@vue/devtools-api" "^6.5.0"
+    vue-demi ">=0.14.5"
+
 posix-character-classes@^0.1.0:
   version "0.1.1"
   resolved "https://registry.npmmirror.com/posix-character-classes/-/posix-character-classes-0.1.1.tgz#01eac0fe3b5af71a2a6c02feabb8c1fef7e00eab"
@@ -2020,17 +2028,15 @@ postcss-prefix-selector@^1.6.0:
   resolved "https://registry.npmmirror.com/postcss-prefix-selector/-/postcss-prefix-selector-1.16.1.tgz#87a77523838b79c0e8aec29f173234b2987cdc04"
   integrity sha512-Umxu+FvKMwlY6TyDzGFoSUnzW+NOfMBLyC1tAkIjgX+Z/qGspJeRjVC903D7mx7TuBpJlwti2ibXtWuA7fKMeQ==
 
-postcss@^5.2.17:
-  version "5.2.18"
-  resolved "https://registry.npmmirror.com/postcss/-/postcss-5.2.18.tgz#badfa1497d46244f6390f58b319830d9107853c5"
-  integrity sha512-zrUjRRe1bpXKsX1qAJNJjqZViErVuyEkMTRrwu4ud4sbTtIBRmtaYDrHmcGgmrbsW3MHfmtIf+vJumgQn+PrXg==
+postcss-px-to-viewport@^1.1.1:
+  version "1.1.1"
+  resolved "https://registry.npmmirror.com/postcss-px-to-viewport/-/postcss-px-to-viewport-1.1.1.tgz#a25ca410b553c9892cc8b525cc710da47bf1aa55"
+  integrity sha512-2x9oGnBms+e0cYtBJOZdlwrFg/mLR4P1g2IFu7jYKvnqnH/HLhoKyareW2Q/x4sg0BgklHlP1qeWo2oCyPm8FQ==
   dependencies:
-    chalk "^1.1.3"
-    js-base64 "^2.1.9"
-    source-map "^0.5.6"
-    supports-color "^3.2.3"
+    object-assign ">=4.0.1"
+    postcss ">=5.0.2"
 
-postcss@^8.4.39:
+postcss@>=5.0.2, postcss@^8.4.39:
   version "8.4.40"
   resolved "https://registry.npmmirror.com/postcss/-/postcss-8.4.40.tgz#eb81f2a4dd7668ed869a6db25999e02e9ad909d8"
   integrity sha512-YF2kKIUzAofPMpfH6hOi2cGnv/HrUlfucspc7pDyvv7kGdqXrfj8SCl/t8owkEgKEuu8ZcRjSOxFxVLqwChZ2Q==
@@ -2039,6 +2045,16 @@ postcss@^8.4.39:
     picocolors "^1.0.1"
     source-map-js "^1.2.0"
 
+postcss@^5.2.17:
+  version "5.2.18"
+  resolved "https://registry.npmmirror.com/postcss/-/postcss-5.2.18.tgz#badfa1497d46244f6390f58b319830d9107853c5"
+  integrity sha512-zrUjRRe1bpXKsX1qAJNJjqZViErVuyEkMTRrwu4ud4sbTtIBRmtaYDrHmcGgmrbsW3MHfmtIf+vJumgQn+PrXg==
+  dependencies:
+    chalk "^1.1.3"
+    js-base64 "^2.1.9"
+    source-map "^0.5.6"
+    supports-color "^3.2.3"
+
 posthtml-parser@^0.2.0, posthtml-parser@^0.2.1:
   version "0.2.1"
   resolved "https://registry.npmmirror.com/posthtml-parser/-/posthtml-parser-0.2.1.tgz#35d530de386740c2ba24ff2eb2faf39ccdf271dd"
@@ -2730,6 +2746,11 @@ vscode-uri@^3.0.8:
   resolved "https://registry.npmmirror.com/vscode-uri/-/vscode-uri-3.0.8.tgz#1770938d3e72588659a172d0fd4642780083ff9f"
   integrity sha512-AyFQ0EVmsOZOlAnxoFOGOq1SQDWAB7C6aqMGS23svWAllfOaxbuFvcT8D1i8z3Gyn8fraVeZNNmN6e9bxxXkKw==
 
+vue-demi@>=0.14.5:
+  version "0.14.10"
+  resolved "https://registry.npmmirror.com/vue-demi/-/vue-demi-0.14.10.tgz#afc78de3d6f9e11bf78c55e8510ee12814522f04"
+  integrity sha512-nMZBOwuzabUO0nLgIcc6rycZEebF6eeUfaiQx9+WSk8e29IbLvPU9feI6tqW4kTo3hvoYAJkMh8n8D0fuISphg==
+
 vue-router@^4.4.0:
   version "4.4.0"
   resolved "https://registry.npmmirror.com/vue-router/-/vue-router-4.4.0.tgz#128e3fc0c84421035a9bd26027245e6bd68f69ab"
@@ -2765,13 +2786,6 @@ vue@^3.4.31:
     "@vue/server-renderer" "3.4.34"
     "@vue/shared" "3.4.34"
 
-vuex@^4.1.0:
-  version "4.1.0"
-  resolved "https://registry.npmmirror.com/vuex/-/vuex-4.1.0.tgz#aa1b3ea5c7385812b074c86faeeec2217872e36c"
-  integrity sha512-hmV6UerDrPcgbSy9ORAtNXDr9M4wlNP4pEFKye4ujJF8oqgFFuxDCdOLS3eNoRTtq5O3hoBDh9Doj1bQMYHRbQ==
-  dependencies:
-    "@vue/devtools-api" "^6.0.0-beta.11"
-
 which-boxed-primitive@^1.0.2:
   version "1.0.2"
   resolved "https://registry.npmmirror.com/which-boxed-primitive/-/which-boxed-primitive-1.0.2.tgz#13757bc89b209b049fe5d86430e21cf40a89a8e6"