|
@@ -144,14 +144,16 @@ export default {
|
|
// 点击菜单项
|
|
// 点击菜单项
|
|
onClickMenu(item) {
|
|
onClickMenu(item) {
|
|
// console.log(item);
|
|
// console.log(item);
|
|
|
|
+ let _this = this
|
|
// 如果要跳转的路由和当前路由一致就 return
|
|
// 如果要跳转的路由和当前路由一致就 return
|
|
if (this.$router.history.current.name == item.routerName) return;
|
|
if (this.$router.history.current.name == item.routerName) return;
|
|
this.$router.push({
|
|
this.$router.push({
|
|
name: item.routerName
|
|
name: item.routerName
|
|
});
|
|
});
|
|
// 如果tags中已经存在
|
|
// 如果tags中已经存在
|
|
- // console.log(includes(item.routerName))
|
|
|
|
console.log(item.routerName)
|
|
console.log(item.routerName)
|
|
|
|
+ console.log(includes(item.routerName))
|
|
|
|
+ let temp = includes(item.routerName)
|
|
let key = "" + new Date().getTime() + Math.floor(Math.random() * 10)
|
|
let key = "" + new Date().getTime() + Math.floor(Math.random() * 10)
|
|
this.tags.push({
|
|
this.tags.push({
|
|
name: item.optionName,
|
|
name: item.optionName,
|
|
@@ -162,8 +164,9 @@ export default {
|
|
this.changeTagColor(key)
|
|
this.changeTagColor(key)
|
|
// localStorage.setItem("tagsNavList", JSON.stringify(this.tags));
|
|
// localStorage.setItem("tagsNavList", JSON.stringify(this.tags));
|
|
// 查看当前 tags里有没有传进来的路由,返回 true false
|
|
// 查看当前 tags里有没有传进来的路由,返回 true false
|
|
- let tags = this.tags
|
|
|
|
|
|
+
|
|
function includes(routerName) {
|
|
function includes(routerName) {
|
|
|
|
+ let tags = _this.tags
|
|
return tags.find(item => {
|
|
return tags.find(item => {
|
|
return item.routerName == routerName
|
|
return item.routerName == routerName
|
|
})
|
|
})
|