diff --git a/src/layouts/components/view.vue b/src/layouts/components/view.vue
index 7147491..2dbcf39 100644
--- a/src/layouts/components/view.vue
+++ b/src/layouts/components/view.vue
@@ -1,13 +1,16 @@
-
+
-
-
+
+
-
+
diff --git a/src/plugins/global-api.js b/src/plugins/global-api.js
new file mode 100644
index 0000000..c855971
--- /dev/null
+++ b/src/plugins/global-api.js
@@ -0,0 +1,16 @@
+import { ElMessage } from './element-plus';
+
+export const copy = (content) => {
+ const el = document.createElement('textarea');
+ el.style.position = 'absolute';
+ el.style.zIndex = '-9999';
+ el.value = content;
+ document.body.appendChild(el);
+ el.select();
+ document.execCommand('copy');
+ el.remove();
+ ElMessage.success('复制成功');
+};
+export default (app) => {
+ app.config.globalProperties.$copy = copy;
+};
diff --git a/src/router/demo.js b/src/router/demo.js
index 3d3434b..be38faf 100644
--- a/src/router/demo.js
+++ b/src/router/demo.js
@@ -5,17 +5,27 @@ export default [
component: () => import('@/layouts/default.vue'),
meta: {
title: '组件示例',
- icon: 'home-fill',
+ icon: 'test-tube-fill',
layout: true,
},
children: [
+ {
+ path: 'icon',
+ name: 'IconDemo',
+ component: () => import('@/views/demo/iconDemo.vue'),
+ meta: {
+ title: '图标库',
+ icon: 'aliens-fill',
+ keepAlive: false,
+ },
+ },
{
path: 'sortable',
name: 'SortableTableDemo',
component: () => import('@/views/demo/sortableTableDemo.vue'),
meta: {
title: '拖拽排序',
- icon: 'home-fill',
+ icon: 'table-2',
},
},
],
diff --git a/src/router/index.js b/src/router/index.js
index 9d76111..6f2cc11 100644
--- a/src/router/index.js
+++ b/src/router/index.js
@@ -22,7 +22,7 @@ export const globalRoutes = [
// 示例模块
import demoModule from './demo';
-export const demoRoutes = import.meta.env.DEV ? demoModule : [];
+export const demoRoutes = import.meta.env.MODE === 'development' ? demoModule : [];
// 动态模块
export const dynamicRoutes = [];
@@ -120,7 +120,7 @@ router.beforeEach(async (to, from, next) => {
export default router;
/**
* 多级嵌套路由时,由于父级路由页面中没有router-view组件所以子级路由页面无法显示
- * 所以需要将路由规则展平处理让所有页面路由规则都是平级
+ * 所以需要将路由规则展平处理
* @param {*} routes
* @param {*} parent
*/
@@ -169,5 +169,12 @@ export const reset = (routes) => {
];
}
flatRoutes(routes).forEach(router.addRoute);
+ store.commit(
+ 'layout/setNotKeepAliveList',
+ router
+ .getRoutes()
+ .filter((item) => item.meta.keepAlive === false)
+ .map((item) => item.name)
+ );
console.info('[router] reset', router.getRoutes());
};
diff --git a/src/store/modules/layout.js b/src/store/modules/layout.js
index d698c62..6d8081a 100644
--- a/src/store/modules/layout.js
+++ b/src/store/modules/layout.js
@@ -8,6 +8,7 @@ const state = () => ({
activeTab: null,
breakcrumbList: [],
autoRouter: false,
+ notKeepAliveList: [],
});
const getters = {
asideList: (state, getters, rootState) => {
@@ -52,6 +53,7 @@ const mutations = {
setActiveTab: (state, data) => (state.activeTab = data),
setBreakcrumbList: (state, data) => (state.breakcrumbList = data),
setAutoRouter: (state, data) => (state.autoRouter = data),
+ setNotKeepAliveList: (state, data) => (state.notKeepAliveList = data),
};
const actions = {};
export default {
diff --git a/src/views/demo/iconDemo.vue b/src/views/demo/iconDemo.vue
new file mode 100644
index 0000000..2d11add
--- /dev/null
+++ b/src/views/demo/iconDemo.vue
@@ -0,0 +1,115 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+