This commit is contained in:
parent
4f561f95db
commit
a313f90c39
|
|
@ -6,37 +6,44 @@
|
||||||
"userName": "Administrator"
|
"userName": "Administrator"
|
||||||
},
|
},
|
||||||
"menuList": [{
|
"menuList": [{
|
||||||
"name": "组件",
|
"name": "vab",
|
||||||
"path": "/vab",
|
"path": "/vab",
|
||||||
"meta": {
|
"meta": {
|
||||||
|
"title": "组件",
|
||||||
"icon": "el-icon-takeaway-box"
|
"icon": "el-icon-takeaway-box"
|
||||||
},
|
},
|
||||||
"children": []
|
"children": []
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "布局",
|
"name": "layout2",
|
||||||
"path": "/layout",
|
"path": "/layout",
|
||||||
"meta": {
|
"meta": {
|
||||||
|
"title": "组件",
|
||||||
"icon": "el-icon-files"
|
"icon": "el-icon-files"
|
||||||
},
|
},
|
||||||
"children": [{
|
"children": [{
|
||||||
"path": "/layout/list",
|
"path": "/layout/list",
|
||||||
"name": "列表",
|
"name": "list",
|
||||||
"meta": {},
|
"meta": {
|
||||||
|
"title": "列表"
|
||||||
|
},
|
||||||
"component": "list"
|
"component": "list"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"path": "/layout/show",
|
"path": "/layout/show",
|
||||||
"name": "详情",
|
"name": "show",
|
||||||
"meta": {},
|
"meta": {
|
||||||
|
"title": "详情"
|
||||||
|
},
|
||||||
"component": "show"
|
"component": "show"
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "其他",
|
"name": "other",
|
||||||
"path": "/other",
|
"path": "/other",
|
||||||
"meta": {
|
"meta": {
|
||||||
|
"title": "其他",
|
||||||
"icon": "el-icon-more"
|
"icon": "el-icon-more"
|
||||||
},
|
},
|
||||||
"children": [
|
"children": [
|
||||||
|
|
@ -44,6 +51,7 @@
|
||||||
"path": "/link",
|
"path": "/link",
|
||||||
"name": "外部链接",
|
"name": "外部链接",
|
||||||
"meta": {
|
"meta": {
|
||||||
|
"title": "外部链接",
|
||||||
"icon": "el-icon-link"
|
"icon": "el-icon-link"
|
||||||
},
|
},
|
||||||
"children": [
|
"children": [
|
||||||
|
|
@ -51,6 +59,7 @@
|
||||||
"path": "https://baidu.com",
|
"path": "https://baidu.com",
|
||||||
"name": "百度",
|
"name": "百度",
|
||||||
"meta": {
|
"meta": {
|
||||||
|
"title": "百度",
|
||||||
"target": "_blank"
|
"target": "_blank"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
@ -58,6 +67,7 @@
|
||||||
"path": "https://www.google.cn",
|
"path": "https://www.google.cn",
|
||||||
"name": "谷歌",
|
"name": "谷歌",
|
||||||
"meta": {
|
"meta": {
|
||||||
|
"title": "谷歌",
|
||||||
"target": "_blank"
|
"target": "_blank"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -67,24 +77,33 @@
|
||||||
"path": "/iframe",
|
"path": "/iframe",
|
||||||
"name": "Iframe",
|
"name": "Iframe",
|
||||||
"meta": {
|
"meta": {
|
||||||
|
"title": "Iframe",
|
||||||
"icon": "el-icon-position"
|
"icon": "el-icon-position"
|
||||||
},
|
},
|
||||||
"children": [
|
"children": [
|
||||||
{
|
{
|
||||||
"path": "https://vue3js.cn/docs/zh/",
|
"path": "https://vue3js.cn/docs/zh/",
|
||||||
"name": "VUE 3"
|
"name": "VUE 3",
|
||||||
|
"meta": {
|
||||||
|
"title": "VUE 3"
|
||||||
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"path": "https://element-plus.org?id=1",
|
"path": "https://element-plus.org?id=1",
|
||||||
"name": "Element Plus"
|
"name": "Element Plus",
|
||||||
|
"meta": {
|
||||||
|
"title": "Element Plus"
|
||||||
|
}
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"path": "/other/lala",
|
"path": "/other/lala",
|
||||||
"name": "404",
|
"name": "404",
|
||||||
"meta": {},
|
"component": "lala",
|
||||||
"component": "lala"
|
"meta": {
|
||||||
|
"title": "模拟404"
|
||||||
|
}
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
|
|
@ -92,12 +111,15 @@
|
||||||
"name": "配置",
|
"name": "配置",
|
||||||
"path": "/setting",
|
"path": "/setting",
|
||||||
"meta": {
|
"meta": {
|
||||||
|
"title": "配置",
|
||||||
"icon": "el-icon-setting"
|
"icon": "el-icon-setting"
|
||||||
},
|
},
|
||||||
"children": [{
|
"children": [{
|
||||||
"path": "/setting/1",
|
"path": "/setting/1",
|
||||||
"name": "setting1",
|
"name": "setting1",
|
||||||
"meta": {},
|
"meta": {
|
||||||
|
"title": "系统设置"
|
||||||
|
},
|
||||||
"component": "lala"
|
"component": "lala"
|
||||||
}]
|
}]
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -5,7 +5,9 @@
|
||||||
<script>
|
<script>
|
||||||
export default {
|
export default {
|
||||||
name: 'App',
|
name: 'App',
|
||||||
setup() {}
|
setup() {
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -6,12 +6,12 @@
|
||||||
<el-menu-item v-if="!navMenu.children" :index="navMenu.path">
|
<el-menu-item v-if="!navMenu.children" :index="navMenu.path">
|
||||||
<a v-if="navMenu.meta&&navMenu.meta.target" :href="navMenu.path" :target="navMenu.meta.target" @click.stop='a'></a>
|
<a v-if="navMenu.meta&&navMenu.meta.target" :href="navMenu.path" :target="navMenu.meta.target" @click.stop='a'></a>
|
||||||
<i v-if="navMenu.meta&&navMenu.meta.icon" :class="navMenu.meta.icon || 'el-icon-menu'"></i>
|
<i v-if="navMenu.meta&&navMenu.meta.icon" :class="navMenu.meta.icon || 'el-icon-menu'"></i>
|
||||||
<span>{{navMenu.name}}</span>
|
<span>{{navMenu.meta.title}}</span>
|
||||||
</el-menu-item>
|
</el-menu-item>
|
||||||
<el-submenu v-if="navMenu.children" :index="navMenu.path">
|
<el-submenu v-if="navMenu.children" :index="navMenu.path">
|
||||||
<template #title>
|
<template #title>
|
||||||
<i v-if="navMenu.meta&&navMenu.meta.icon" :class="navMenu.meta.icon || 'el-icon-menu'"></i>
|
<i v-if="navMenu.meta&&navMenu.meta.icon" :class="navMenu.meta.icon || 'el-icon-menu'"></i>
|
||||||
<span> {{navMenu.name}}</span>
|
<span> {{navMenu.meta.title}}</span>
|
||||||
</template>
|
</template>
|
||||||
<NavMenu :navMenus="navMenu.children"></NavMenu>
|
<NavMenu :navMenus="navMenu.children"></NavMenu>
|
||||||
</el-submenu>
|
</el-submenu>
|
||||||
|
|
|
||||||
|
|
@ -3,7 +3,7 @@
|
||||||
<div class="left-panel">
|
<div class="left-panel">
|
||||||
<el-breadcrumb separator-class="el-icon-arrow-right">
|
<el-breadcrumb separator-class="el-icon-arrow-right">
|
||||||
<template v-for="(item) in breadList" v-bind:key="item" >
|
<template v-for="(item) in breadList" v-bind:key="item" >
|
||||||
<el-breadcrumb-item v-if="item.path !='/'"><i v-if="item.meta&&item.meta.icon" :class="item.meta.icon || 'el-icon-menu'"></i>{{item.name}}</el-breadcrumb-item>
|
<el-breadcrumb-item v-if="item.path !='/'"><i v-if="item.meta&&item.meta.icon" :class="item.meta.icon || 'el-icon-menu'"></i>{{item.meta.title}}</el-breadcrumb-item>
|
||||||
</template>
|
</template>
|
||||||
</el-breadcrumb>
|
</el-breadcrumb>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
||||||
|
|
@ -3,7 +3,7 @@
|
||||||
<div class="adminui-side-split-scroll">
|
<div class="adminui-side-split-scroll">
|
||||||
<ul>
|
<ul>
|
||||||
<li v-for="item in menu" v-bind:key="item" :class="pmenu.path==item.path?'active':''" @click="showMenu(item)"><i :class="item.meta.icon || 'el-icon-menu'"></i>
|
<li v-for="item in menu" v-bind:key="item" :class="pmenu.path==item.path?'active':''" @click="showMenu(item)"><i :class="item.meta.icon || 'el-icon-menu'"></i>
|
||||||
<p>{{ item.name }}</p>
|
<p>{{ item.meta.title }}</p>
|
||||||
</li>
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
||||||
|
|
@ -3,7 +3,7 @@
|
||||||
<ul>
|
<ul>
|
||||||
<li v-for="tag in tagList" v-bind:key="tag" :class="isActive(tag) ? 'active' : '' " @contextmenu.prevent="openContextMenu($event, tag)">
|
<li v-for="tag in tagList" v-bind:key="tag" :class="isActive(tag) ? 'active' : '' " @contextmenu.prevent="openContextMenu($event, tag)">
|
||||||
<router-link :to="tag">
|
<router-link :to="tag">
|
||||||
{{ tag.name }}
|
{{ tag.meta.title }}
|
||||||
<i v-if="!tag.meta.affix" class="el-icon-close" @click.prevent.stop='closeSelectedTag(tag)'></i>
|
<i v-if="!tag.meta.affix" class="el-icon-close" @click.prevent.stop='closeSelectedTag(tag)'></i>
|
||||||
</router-link>
|
</router-link>
|
||||||
</li>
|
</li>
|
||||||
|
|
@ -59,6 +59,7 @@
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
export default {
|
export default {
|
||||||
|
name: "tags",
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
contextMenuVisible: false,
|
contextMenuVisible: false,
|
||||||
|
|
@ -104,6 +105,7 @@
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
if(!ishas){
|
if(!ishas){
|
||||||
|
this.$store.commit("pushKeepLive",route.name)
|
||||||
this.tagList.push(route)
|
this.tagList.push(route)
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
@ -115,6 +117,7 @@
|
||||||
closeSelectedTag(tag) {
|
closeSelectedTag(tag) {
|
||||||
const newtagList = this.tagList.filter(item => item.path !== tag.path)
|
const newtagList = this.tagList.filter(item => item.path !== tag.path)
|
||||||
this.tagList = newtagList;
|
this.tagList = newtagList;
|
||||||
|
this.$store.commit("removeKeepLive", tag.name)
|
||||||
if (this.isActive(tag)) {
|
if (this.isActive(tag)) {
|
||||||
const latestView = newtagList.slice(-1)[0]
|
const latestView = newtagList.slice(-1)[0]
|
||||||
if (latestView) {
|
if (latestView) {
|
||||||
|
|
|
||||||
|
|
@ -5,7 +5,8 @@
|
||||||
<Head></Head>
|
<Head></Head>
|
||||||
<Tags></Tags>
|
<Tags></Tags>
|
||||||
<div class="adminui-main">
|
<div class="adminui-main">
|
||||||
<router-view :key="$route.fullPath"></router-view>
|
<router-view></router-view>
|
||||||
|
<!-- <router-view :key="$route.fullPath"></router-view> -->
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -6,23 +6,25 @@ import tool from '@/utils/tool';
|
||||||
|
|
||||||
//系统路由
|
//系统路由
|
||||||
const routes = [{
|
const routes = [{
|
||||||
path: "/",
|
|
||||||
name: "layout",
|
name: "layout",
|
||||||
|
path: "/",
|
||||||
component: () => import(/* webpackChunkName: "layout" */ '@/layout'),
|
component: () => import(/* webpackChunkName: "layout" */ '@/layout'),
|
||||||
redirect: '/dashboard',
|
redirect: '/dashboard',
|
||||||
children: [
|
children: [
|
||||||
{
|
{
|
||||||
|
name: "home",
|
||||||
path: "/home",
|
path: "/home",
|
||||||
name: "首页",
|
|
||||||
component: () => import(`@/views/other/empty`),
|
component: () => import(`@/views/other/empty`),
|
||||||
meta: {
|
meta: {
|
||||||
|
title: "首页",
|
||||||
icon: "el-icon-platform-eleme"
|
icon: "el-icon-platform-eleme"
|
||||||
},
|
},
|
||||||
children: [
|
children: [
|
||||||
{
|
{
|
||||||
|
name: "dashboard",
|
||||||
path: "/dashboard",
|
path: "/dashboard",
|
||||||
name: "控制台",
|
|
||||||
meta: {
|
meta: {
|
||||||
|
title: "控制台",
|
||||||
affix: true
|
affix: true
|
||||||
},
|
},
|
||||||
component: () => import(/* webpackChunkName: "home" */ '@/views/home'),
|
component: () => import(/* webpackChunkName: "home" */ '@/views/home'),
|
||||||
|
|
@ -32,9 +34,12 @@ const routes = [{
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
name: "login",
|
||||||
path: "/login",
|
path: "/login",
|
||||||
name: "登录",
|
|
||||||
component: () => import(/* webpackChunkName: "login" */ '@/views/login'),
|
component: () => import(/* webpackChunkName: "login" */ '@/views/login'),
|
||||||
|
meta: {
|
||||||
|
title: "登录"
|
||||||
|
}
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,8 +1,8 @@
|
||||||
import { createStore } from 'vuex';
|
import { createStore } from 'vuex';
|
||||||
import tagsView from './modules/tagsView';
|
import keepAlive from './modules/keepAlive';
|
||||||
|
|
||||||
export default createStore({
|
export default createStore({
|
||||||
modules: {
|
modules: {
|
||||||
tagsView
|
keepAlive
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,21 @@
|
||||||
|
export default {
|
||||||
|
state: {
|
||||||
|
keepLiveRoute: []
|
||||||
|
},
|
||||||
|
mutations: {
|
||||||
|
pushKeepLive(state, component){
|
||||||
|
if(!state.keepLiveRoute.includes(component)){
|
||||||
|
state.keepLiveRoute.push(component)
|
||||||
|
}
|
||||||
|
},
|
||||||
|
removeKeepLive(state, component){
|
||||||
|
var index = state.keepLiveRoute.indexOf(component);
|
||||||
|
if(index !== -1){
|
||||||
|
state.keepLiveRoute.splice(index, 1);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
clearKeepLive(state){
|
||||||
|
state.keepLiveRoute = []
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -1,24 +0,0 @@
|
||||||
export default {
|
|
||||||
state: {
|
|
||||||
visitedViews: [],
|
|
||||||
cachedViews: []
|
|
||||||
},
|
|
||||||
mutations: {
|
|
||||||
ADD_VISITED_VIEWS: (state, view) => {
|
|
||||||
if (state.visitedViews.some(v => v.path === view.path)) return
|
|
||||||
state.visitedViews.push(Object.assign({}, view, {
|
|
||||||
title: view.meta.title || 'no-name'
|
|
||||||
}))
|
|
||||||
if (!view.meta.noCache) {
|
|
||||||
state.cachedViews.push(view.name)
|
|
||||||
}
|
|
||||||
},
|
|
||||||
},
|
|
||||||
actions: {
|
|
||||||
addVisitedViews({
|
|
||||||
commit
|
|
||||||
}, view) {
|
|
||||||
commit('ADD_VISITED_VIEWS', view)
|
|
||||||
},
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -45,13 +45,21 @@
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
|
export default {
|
||||||
|
name: "dashboard",
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style scoped>
|
<style scoped>
|
||||||
.el-row {margin-bottom:20px;}
|
.el-row {margin-bottom:20px;}
|
||||||
.el-tag+.el-tag {margin-left: 10px;}
|
.el-tag+.el-tag {margin-left: 10px;}
|
||||||
|
|
||||||
|
|
||||||
.welTop {display: flex;}
|
.welTop {display: flex;}
|
||||||
.welTop .main {margin-left:20px;}
|
.welTop .main {margin-left:20px;}
|
||||||
.welTop .main h2 {font-size: 20px;color: #3c4a54;}
|
.welTop .main h2 {font-size: 20px;color: #3c4a54;}
|
||||||
|
|
|
||||||
|
|
@ -1,10 +1,19 @@
|
||||||
<template>
|
<template>
|
||||||
<div>
|
<div>
|
||||||
<el-empty description="LIST"></el-empty>
|
<el-empty description="LIST"></el-empty>
|
||||||
|
<el-input v-model="input" placeholder="请输入内容"></el-input>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
|
export default {
|
||||||
|
name: 'list',
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
input: ""
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style>
|
<style>
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,20 @@
|
||||||
<template>
|
<template>
|
||||||
<router-view></router-view>
|
<router-view v-slot="{ Component }">
|
||||||
|
<keep-alive :include="keepAliveNameList">
|
||||||
|
<component :is="Component" :key="$route.fullPath"/>
|
||||||
|
</keep-alive>
|
||||||
|
</router-view>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
export default {
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
keepAliveNameList: this.$store.state.keepAlive.keepLiveRoute
|
||||||
|
}
|
||||||
|
},
|
||||||
|
created: function() {
|
||||||
|
|
||||||
|
},
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
|
||||||
|
|
@ -1,15 +1,17 @@
|
||||||
<template>
|
<template>
|
||||||
<div>
|
<div>
|
||||||
<el-empty description="SHOW"></el-empty>
|
<el-empty description="SHOW"></el-empty>
|
||||||
|
<el-input v-model="input" placeholder="请输入内容"></el-input>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
export default {
|
export default {
|
||||||
|
name: 'show',
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
input: ''
|
input: ""
|
||||||
};
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue