|
@@ -123,9 +123,6 @@ export default {
|
|
|
{ name: "设备类型", routerName: "deviceInfo", key: "0" }
|
|
|
];
|
|
|
},
|
|
|
- mounted() {
|
|
|
- console.log(this);
|
|
|
- },
|
|
|
methods: {
|
|
|
// 收取菜单按钮
|
|
|
onMenuCollapse() {
|
|
@@ -146,16 +143,16 @@ export default {
|
|
|
},
|
|
|
// 点击菜单项
|
|
|
onClickMenu(item) {
|
|
|
- let key = "" + new Date().getTime() + Math.floor(Math.random() * 10)
|
|
|
- console.log(item);
|
|
|
+ // console.log(item);
|
|
|
// 如果要跳转的路由和当前路由一致就 return
|
|
|
if (this.$router.history.current.name == item.routerName) return;
|
|
|
this.$router.push({
|
|
|
name: item.routerName
|
|
|
});
|
|
|
// 如果tags中已经存在
|
|
|
- // if(this.tags.includes(item.routerName)) return
|
|
|
- console.log(this.tags.includes(item.routerName))
|
|
|
+ // console.log(includes(item.routerName))
|
|
|
+ console.log(item.routerName)
|
|
|
+ let key = "" + new Date().getTime() + Math.floor(Math.random() * 10)
|
|
|
this.tags.push({
|
|
|
name: item.optionName,
|
|
|
routerName: item.routerName,
|
|
@@ -163,11 +160,18 @@ export default {
|
|
|
type: "success"
|
|
|
});
|
|
|
this.changeTagColor(key)
|
|
|
- localStorage.setItem("tagsNavList", JSON.stringify(this.tags));
|
|
|
+ // localStorage.setItem("tagsNavList", JSON.stringify(this.tags));
|
|
|
+ // 查看当前 tags里有没有传进来的路由,返回 true false
|
|
|
+ let tags = this.tags
|
|
|
+ function includes(routerName) {
|
|
|
+ return tags.find(item => {
|
|
|
+ return item.routerName == routerName
|
|
|
+ })
|
|
|
+ }
|
|
|
},
|
|
|
// 点击 tag
|
|
|
clickTag(tag) {
|
|
|
- console.log(tag);
|
|
|
+ console.log(tag.routerName);
|
|
|
if (this.$router.history.current.name == tag.routerName) return;
|
|
|
this.$router.push({
|
|
|
name: tag.routerName
|