mirror of
https://gitee.com/beijing_hongye_huicheng/lilishop-ui.git
synced 2026-08-06 10:57:26 +08:00
升级Vue3,iView替换ElementPlus
- 删除babel配置、更新依赖与入口初始化 - 全量替换UI组件、样式适配,新增迁移文档与标签/过滤器自动化替换脚本
This commit is contained in:
@@ -1,30 +1,19 @@
|
||||
import Vue from 'vue';
|
||||
import Vuex from 'vuex';
|
||||
import { createStore } from "vuex";
|
||||
import app from "./modules/app";
|
||||
import setting from "./modules/setting";
|
||||
import user from "./modules/user";
|
||||
import dict from "./modules/dict";
|
||||
|
||||
import app from './modules/app';
|
||||
import setting from './modules/setting';
|
||||
import user from './modules/user';
|
||||
import dict from './modules/dict';
|
||||
|
||||
Vue.use(Vuex);
|
||||
|
||||
const store = new Vuex.Store({
|
||||
state: {
|
||||
// 状态
|
||||
|
||||
},
|
||||
mutations: {
|
||||
// 改变方法
|
||||
},
|
||||
actions: {
|
||||
|
||||
},
|
||||
modules: {
|
||||
app,
|
||||
user,
|
||||
setting,
|
||||
dict
|
||||
}
|
||||
const store = createStore({
|
||||
state: {},
|
||||
mutations: {},
|
||||
actions: {},
|
||||
modules: {
|
||||
app,
|
||||
user,
|
||||
setting,
|
||||
dict,
|
||||
},
|
||||
});
|
||||
|
||||
export default store;
|
||||
|
||||
@@ -1,61 +1,52 @@
|
||||
import { otherRouter } from '@/router/router';
|
||||
import { router } from '@/router/index';
|
||||
import Util from '@/libs/util';
|
||||
import Vue from 'vue';
|
||||
import { otherRouter } from "@/router/router";
|
||||
import Util from "@/libs/util";
|
||||
|
||||
const app = {
|
||||
state: {
|
||||
shipTemplates: "",
|
||||
regions: [], //此处是在地区选择器时赋值一次
|
||||
styleStore: "", //移动端楼层装修中选择风格存储
|
||||
loading: false, // 全局加载动画
|
||||
added: false, // 加载路由标识
|
||||
navList: [], // 顶部菜单
|
||||
currNav: "", // 当前顶部菜单name
|
||||
currNavTitle: "", // 当前顶部菜单标题
|
||||
cachePage: [], // 缓存的页面
|
||||
lang: '',
|
||||
regions: [],
|
||||
styleStore: "",
|
||||
loading: false,
|
||||
added: false,
|
||||
navList: [],
|
||||
currNav: "",
|
||||
currNavTitle: "",
|
||||
cachePage: [],
|
||||
lang: "",
|
||||
isFullScreen: false,
|
||||
openedSubmenuArr: [], // 要展开的菜单数组
|
||||
menuTheme: 'dark', // 主题
|
||||
themeColor: '',
|
||||
storeOpenedList: [{
|
||||
title: '首页',
|
||||
path: '',
|
||||
name: 'home_index'
|
||||
}],
|
||||
currentPageName: '',
|
||||
openedSubmenuArr: [],
|
||||
menuTheme: "dark",
|
||||
themeColor: "",
|
||||
storeOpenedList: [
|
||||
{
|
||||
title: "首页",
|
||||
path: "",
|
||||
name: "home_index",
|
||||
},
|
||||
],
|
||||
currentPageName: "",
|
||||
currentPath: [
|
||||
{
|
||||
title: '首页',
|
||||
path: '',
|
||||
name: 'home_index'
|
||||
}
|
||||
title: "首页",
|
||||
path: "",
|
||||
name: "home_index",
|
||||
},
|
||||
],
|
||||
// 面包屑数组 左侧菜单
|
||||
menuList: [],
|
||||
routers: [
|
||||
otherRouter
|
||||
],
|
||||
routers: [otherRouter],
|
||||
tagsList: [...otherRouter.children],
|
||||
messageCount: 0,
|
||||
// 在这里定义你不想要缓存的页面的name属性值(参见路由配置router.js)
|
||||
dontCache: ['test', 'test'],
|
||||
refMenu:""
|
||||
dontCache: ["test", "test"],
|
||||
refMenu: "",
|
||||
},
|
||||
mutations: {
|
||||
childrenMenu(state,v){
|
||||
state.refMenu = v
|
||||
childrenMenu(state, v) {
|
||||
state.refMenu = v;
|
||||
},
|
||||
// 动态添加主界面路由,需要缓存
|
||||
updateAppRouter(state, routes) {
|
||||
state.routers.push(...routes);
|
||||
router.addRoutes(routes);
|
||||
},
|
||||
// 动态添加全局路由404、500等页面,不需要缓存
|
||||
updateDefaultRouter(state, routes) {
|
||||
router.addRoutes(routes);
|
||||
},
|
||||
updateDefaultRouter() {},
|
||||
setLoading(state, v) {
|
||||
state.loading = v;
|
||||
},
|
||||
@@ -78,15 +69,7 @@ const app = {
|
||||
state.menuList = routes;
|
||||
},
|
||||
addOpenSubmenu(state, name) {
|
||||
let hasThisName = false;
|
||||
let isEmpty = false;
|
||||
if (name.length == 0) {
|
||||
isEmpty = true;
|
||||
}
|
||||
if (state.openedSubmenuArr.indexOf(name) > -1) {
|
||||
hasThisName = true;
|
||||
}
|
||||
if (!hasThisName && !isEmpty) {
|
||||
if (name.length && state.openedSubmenuArr.indexOf(name) === -1) {
|
||||
state.openedSubmenuArr.push(name);
|
||||
}
|
||||
},
|
||||
@@ -112,19 +95,15 @@ const app = {
|
||||
},
|
||||
storeOpenedList(state, get) {
|
||||
let openedPage = state.storeOpenedList[get.index];
|
||||
if (get.argu) {
|
||||
openedPage.argu = get.argu;
|
||||
}
|
||||
if (get.query) {
|
||||
openedPage.query = get.query;
|
||||
}
|
||||
if (get.argu) openedPage.argu = get.argu;
|
||||
if (get.query) openedPage.query = get.query;
|
||||
state.storeOpenedList.splice(get.index, 1, openedPage);
|
||||
localStorage.storeOpenedList = JSON.stringify(state.storeOpenedList);
|
||||
},
|
||||
clearAllTags(state) {
|
||||
state.storeOpenedList.splice(1);
|
||||
state.cachePage.length = 0;
|
||||
localStorage.cachePage = '';
|
||||
localStorage.cachePage = "";
|
||||
localStorage.storeOpenedList = JSON.stringify(state.storeOpenedList);
|
||||
},
|
||||
clearOtherTags(state, vm) {
|
||||
@@ -141,15 +120,14 @@ const app = {
|
||||
state.storeOpenedList.splice(currentIndex + 1);
|
||||
state.storeOpenedList.splice(1, currentIndex - 1);
|
||||
}
|
||||
let newCachepage = state.cachePage.filter(item => {
|
||||
return item == currentName;
|
||||
});
|
||||
state.cachePage = newCachepage;
|
||||
state.cachePage = state.cachePage.filter((item) => item == currentName);
|
||||
localStorage.cachePage = JSON.stringify(state.cachePage);
|
||||
localStorage.storeOpenedList = JSON.stringify(state.storeOpenedList);
|
||||
},
|
||||
setOpenedList(state) {
|
||||
state.storeOpenedList = localStorage.storeOpenedList ? JSON.parse(localStorage.storeOpenedList) : [otherRouter.children[0]];
|
||||
state.storeOpenedList = localStorage.storeOpenedList
|
||||
? JSON.parse(localStorage.storeOpenedList)
|
||||
: [otherRouter.children[0]];
|
||||
},
|
||||
setCurrentPath(state, pathArr) {
|
||||
state.currentPath = pathArr;
|
||||
@@ -163,7 +141,6 @@ const app = {
|
||||
switchLang(state, lang) {
|
||||
state.lang = lang;
|
||||
localStorage.lang = lang;
|
||||
Vue.config.lang = lang;
|
||||
},
|
||||
clearOpenedSubmenu(state) {
|
||||
state.openedSubmenuArr.length = 0;
|
||||
@@ -171,7 +148,6 @@ const app = {
|
||||
setMessageCount(state, count) {
|
||||
state.messageCount = count;
|
||||
},
|
||||
// 新增页签
|
||||
increateTag(state, tagObj) {
|
||||
if (!Util.oneOf(tagObj.name, state.dontCache)) {
|
||||
state.cachePage.push(tagObj.name);
|
||||
@@ -179,8 +155,8 @@ const app = {
|
||||
}
|
||||
state.storeOpenedList.push(tagObj);
|
||||
localStorage.storeOpenedList = JSON.stringify(state.storeOpenedList);
|
||||
}
|
||||
}
|
||||
},
|
||||
},
|
||||
};
|
||||
|
||||
export default app;
|
||||
|
||||
Reference in New Issue
Block a user