Commit fc556d1c authored by 汪晓凯's avatar 汪晓凯

bugfix_路由跳转bug

parent 52d4228b
<template> <template>
<div class="nav-left"> <div class="nav-left">
<el-menu <el-menu
:default-openeds="['1', '2']"
:default-active="active" :default-active="active"
class="el-menu-vertical-demo" class="el-menu-vertical-demo"
:router="true" :router="true"
@select="navClick"> @select="navClick">
<el-menu-item index="home"> <el-menu-item index="/monitor/home">
<span slot="title">首页</span> <span slot="title">首页</span>
</el-menu-item> </el-menu-item>
<el-submenu index="1"> <el-submenu index="1">
<template slot="title">网站监控</template> <template slot="title">网站监控</template>
<el-menu-item :index="index+''" v-for="(item, index) in platInfo" :key="item.platform">{{item.platform}}</el-menu-item> <el-menu-item :index="`/monitor/${index}`" v-for="(item, index) in platInfo" :key="item.platform">{{item.platform}}</el-menu-item>
</el-submenu> </el-submenu>
<el-submenu index="2"> <el-submenu index="2">
<template slot="title">币种监控</template> <template slot="title">币种监控</template>
<el-menu-item index="BTY">BTY</el-menu-item> <el-menu-item index="/monitor/BTY">BTY</el-menu-item>
<el-menu-item index="YCC">YCC</el-menu-item> <el-menu-item index="/monitor/YCC">YCC</el-menu-item>
</el-submenu> </el-submenu>
<el-menu-item index="/monitor/account"> <el-menu-item index="/monitor/account">
<span slot="title">银行账户</span> <span slot="title">银行账户</span>
...@@ -37,22 +38,28 @@ ...@@ -37,22 +38,28 @@
}, },
props: ['platInfo'], props: ['platInfo'],
created() { created() {
this.active = this.$route.params.name || this.$route.path; if (this.$route.path.split('/').pop() === 'RobotDetail') {
this.active = this.$route.path.split('/').splice(0,3).join('/');
}else {
this.active = this.$route.path;
}
}, },
methods: { methods: {
navClick(index) { navClick(index) {
this.active = index; this.active = index;
this.$router.push(index);
if(index !== '/monitor/account' && index !== '/monitor/coinRecharge'){ if(index !== '/monitor/account' && index !== '/monitor/coinRecharge'){
this.$router.push(`/monitor/${index}`);
Bus.$emit('refresh'); Bus.$emit('refresh');
}else {
this.$router.push(index);
} }
} }
}, },
watch: { watch: {
$route() { $route() {
this.active = this.$route.params.name || this.$route.path; if (this.$route.path.split('/').pop() === 'RobotDetail') {
this.active = this.$route.path.split('/').splice(0,3).join('/');
}else {
this.active = this.$route.path;
}
}, },
}, },
} }
......
...@@ -224,29 +224,29 @@ ...@@ -224,29 +224,29 @@
}, },
methods: { methods: {
init(type) { init(type) {
const RoutePath = this.$route.params.name; const RoutePath = this.$route.path;
// console.log(RoutePath); // console.log(RoutePath);
var StatusParams = {platform: '', coin: ''};//预警状态查询入参 var StatusParams = {platform: '', coin: ''};//预警状态查询入参
switch (RoutePath) { switch (RoutePath) {
case 'home': case '/monitor/home':
this.showWebFilter = this.showCurrencyFilter = true; this.showWebFilter = this.showCurrencyFilter = true;
this.showPairFilter = false; this.showPairFilter = false;
this.RobotListParams.coin = []; this.RobotListParams.coin = [];
this.RobotListParams.platform = []; this.RobotListParams.platform = [];
break; break;
case 'BTY': case '/monitor/BTY':
case 'YCC': case '/monitor/YCC':
this.showWebFilter = true; this.showWebFilter = true;
this.showCurrencyFilter = this.showPairFilter = false; this.showCurrencyFilter = this.showPairFilter = false;
StatusParams.coin = RoutePath; StatusParams.coin = RoutePath.split('/').pop();
this.RobotListParams.coin = [RoutePath]; this.RobotListParams.coin = [RoutePath.split('/').pop()];
this.RobotListParams.platform = []; this.RobotListParams.platform = [];
break; break;
default: default:
if (RoutePath) { if (RoutePath) {
this.showPairFilter = true; this.showPairFilter = true;
this.showWebFilter = this.showCurrencyFilter = false; this.showWebFilter = this.showCurrencyFilter = false;
var index = +RoutePath; var index = RoutePath.split('/').pop();
this.checkedPairs = this.pairs = JSON.parse(sessionStorage.getItem('platInfo'))[index].symbol; this.checkedPairs = this.pairs = JSON.parse(sessionStorage.getItem('platInfo'))[index].symbol;
this.platform = JSON.parse(sessionStorage.getItem('platInfo'))[index].platform; this.platform = JSON.parse(sessionStorage.getItem('platInfo'))[index].platform;
StatusParams.platform = this.platform; StatusParams.platform = this.platform;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment