|
@@ -17,13 +17,12 @@
|
|
|
<template slot="title">{{item.content}}</template>
|
|
|
<el-menu-item :index="`${child.keyPath}`" v-for="child of item.children"
|
|
|
:key="child.keyPath">
|
|
|
- <a :href="`https://www.mtavip.com${child.keyPath}`">{{child.content}}</a>
|
|
|
+ <mtaLink :path="child.keyPath" :instation="true" :content="child.content"></mtaLink>
|
|
|
</el-menu-item>
|
|
|
</el-submenu>
|
|
|
|
|
|
<el-menu-item :index="`${item.keyPath}`" v-else>
|
|
|
-
|
|
|
- <a :href="`https://www.mtavip.com${item.keyPath}`">{{item.content}}</a>
|
|
|
+ <mtaLink :path="item.keyPath" :instation="true" :content="item.content"></mtaLink>
|
|
|
</el-menu-item>
|
|
|
</template>
|
|
|
</el-menu>
|
|
@@ -37,10 +36,14 @@
|
|
|
</template>
|
|
|
|
|
|
<script>
|
|
|
- let _ = require('lodash')
|
|
|
- export default {
|
|
|
+ import mtaLink from '~/components/mtaLink/index';
|
|
|
|
|
|
+ let _ = require('lodash');
|
|
|
+ export default {
|
|
|
name: 'mtaHeader',
|
|
|
+ components: {
|
|
|
+ mtaLink,
|
|
|
+ },
|
|
|
props: {
|
|
|
activeNav: { // 默认选中的 路径 与组件中的index相互对应
|
|
|
type: String,
|
|
@@ -48,14 +51,13 @@
|
|
|
default: '0',
|
|
|
},
|
|
|
},
|
|
|
- components: {},
|
|
|
data() {
|
|
|
return {
|
|
|
activeIndex: this.activeNav,
|
|
|
- headerArr: [
|
|
|
+ headerArr: [
|
|
|
{
|
|
|
content: '首页',
|
|
|
- keyPath: '/',
|
|
|
+ keyPath: '/?userId=1',
|
|
|
},
|
|
|
{
|
|
|
content: '考试平台',
|
|
@@ -98,23 +100,19 @@
|
|
|
},
|
|
|
immediate: true,
|
|
|
},
|
|
|
- /* $route: {
|
|
|
- handler: function(val, oldVal){
|
|
|
- debugger;
|
|
|
- this.activeIndexSync();
|
|
|
- },
|
|
|
- // 深度观察监听
|
|
|
- deep: true
|
|
|
- }*/
|
|
|
- },
|
|
|
- computed: {
|
|
|
-
|
|
|
+ /* $route: {
|
|
|
+ handler: function(val, oldVal){
|
|
|
+ debugger;
|
|
|
+ this.activeIndexSync();
|
|
|
+ },
|
|
|
+ // 深度观察监听
|
|
|
+ deep: true
|
|
|
+ }*/
|
|
|
},
|
|
|
methods: {
|
|
|
|
|
|
activeIndexSync() {
|
|
|
const path = this.$route.path;
|
|
|
- console.log(path);
|
|
|
const idx = _.findIndex(this.headerArr, function (o) {
|
|
|
return o.keyPath === path;
|
|
|
});
|
|
@@ -134,9 +132,9 @@
|
|
|
}
|
|
|
}
|
|
|
},
|
|
|
- }
|
|
|
- ,
|
|
|
- created() {
|
|
|
+ },
|
|
|
+ mounted() {
|
|
|
+ console.log('head:', this.$route.query)
|
|
|
},
|
|
|
};
|
|
|
</script>
|