修改路由

dev
夜笙歌 1 year ago
parent 308f1000a4
commit da13e574c2

@ -2,27 +2,27 @@
<div> <div>
<div class="title">智慧物联监控平台</div> <div class="title">智慧物联监控平台</div>
<div> <div>
<div :class="`menu ${nowMenu==='1'? 'menuClick' :''}`" style="left: 2%"> <div :class="`menu ${nowMenu==='1'? 'menuClick' :''}`" style="left: 2%" @click="toLink('index')">
<span> <span>
监控主页 监控主页
</span> </span>
</div> </div>
<div :class="`menu ${nowMenu==='2'? 'menuClick' :''}`" style="left: 9%"> <div :class="`menu ${nowMenu==='2'? 'menuClick' :''}`" style="left: 9%">
<el-dropdown trigger="click"> <el-dropdown trigger="click" @command="dropdownLink">
<span class="el-dropdown-link"> <span class="el-dropdown-link">
智慧场景 <i class="el-icon-arrow-down el-icon--right"></i> {{ name }} <i class="el-icon-arrow-down el-icon--right"></i>
</span> </span>
<el-dropdown-menu slot="dropdown" > <el-dropdown-menu slot="dropdown" >
<el-dropdown-item v-for="i in selectSecnesList">{{ i.sceneName }}</el-dropdown-item> <el-dropdown-item :command="{router:i.router,name:i.sceneName}" v-for="i in selectSecnesList">{{ i.sceneName }}</el-dropdown-item>
</el-dropdown-menu> </el-dropdown-menu>
</el-dropdown> </el-dropdown>
</div> </div>
<div :class="`menu ${nowMenu==='3'? 'menuClick' :''}`" style="left: 16%"> <div :class="`menu ${nowMenu==='3'? 'menuClick' :''}`" style="left: 16%" @click="toLink('equipmentMonitoring')">
<span> <span>
设备监测 设备监测
</span> </span>
</div> </div>
<div :class="`menu ${nowMenu==='4'? 'menuClick' :''}`" style="left: 23%"> <div :class="`menu ${nowMenu==='4'? 'menuClick' :''}`" style="left: 23%" @click="toLink('senso')">
<span> <span>
传感器汇总 传感器汇总
</span> </span>
@ -48,7 +48,8 @@ import {
export default { export default {
data() { data() {
return { return {
selectSecnesList: [] selectSecnesList: [],
name:'智慧场景'
} }
}, },
props: { props: {
@ -60,11 +61,23 @@ export default {
mounted() { mounted() {
this.setSelectSecnes() this.setSelectSecnes()
if(this.$route.name === 'SmartScene'){
if(this.$route.query?.name){
this.name = this.$route.query?.name
}
}
}, },
methods: { methods: {
async setSelectSecnes() { async setSelectSecnes() {
const {data} = await selectSecnes() const {data} = await selectSecnes()
this.selectSecnesList = data this.selectSecnesList = data
},
toLink(e){
this.$router.push({ path: "/board/"+e });
},
dropdownLink(e){
this.name = e.name
this.$router.push({ path: "/board/"+(e.router||'smartScene'),query: {name: e.name} });
} }
} }
}; };

Loading…
Cancel
Save