添加新的组件配置
parent
702a844b11
commit
5d388771fd
@ -0,0 +1,47 @@
|
||||
<template>
|
||||
<div>
|
||||
<el-menu :default-active="activeIndex" class="el-menu-demo" mode="horizontal" @select="handleSelect"
|
||||
style="position: sticky;top: 0;z-index: 9999;">
|
||||
<el-menu-item index="1">首页</el-menu-item>
|
||||
<el-menu-item index="2">关于海威</el-menu-item>
|
||||
<el-menu-item index="3">行业方案</el-menu-item>
|
||||
<el-menu-item index="4">产品中心</el-menu-item>
|
||||
<el-menu-item index="5">联系我们</el-menu-item>
|
||||
</el-menu>
|
||||
<router-view></router-view>
|
||||
</div>
|
||||
</template>
|
||||
<script>
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
activeIndex: '1',
|
||||
menuRouteMap: {
|
||||
'1': {path: '/editor'},
|
||||
'2': {path: '/editor'},
|
||||
'3': {path: '/editor',},
|
||||
'4': {path: '/productCenter/edit'},
|
||||
'5': {path: '/editor'},
|
||||
}
|
||||
};
|
||||
},
|
||||
mounted() {
|
||||
},
|
||||
watch: {
|
||||
$route() {
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
handleSelect(key) {
|
||||
const target = this.menuRouteMap[key];
|
||||
if (!target) {
|
||||
return;
|
||||
}
|
||||
this.$router.push(target)
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
<style>
|
||||
|
||||
</style>
|
||||
@ -1,17 +1,24 @@
|
||||
import Vue from 'vue'
|
||||
import Router from 'vue-router'
|
||||
import Layout from '@/layout'
|
||||
|
||||
Vue.use(Router)
|
||||
|
||||
export default new Router({
|
||||
routes: [{
|
||||
path: '/', redirect: '/editor',
|
||||
},
|
||||
{
|
||||
path: '/editor', component: () => import('@/views/editPage/index.vue'),
|
||||
},
|
||||
{
|
||||
path: '/productCenter/edit', component: () => import('@/views/productCenter/edit/index.vue'),
|
||||
}
|
||||
]
|
||||
routes: [
|
||||
|
||||
{
|
||||
path: '',
|
||||
component: Layout,
|
||||
redirect: '/editor',
|
||||
children: [
|
||||
{
|
||||
path: '/editor', component: () => import('@/views/editPage/index.vue'),
|
||||
},
|
||||
{
|
||||
path: '/productCenter/edit', component: () => import('@/views/productCenter/edit/index.vue'),
|
||||
}
|
||||
]
|
||||
},
|
||||
]
|
||||
})
|
||||
|
||||
Loading…
Reference in New Issue