mirror of
https://github.com/iczer/vue-antd-admin
synced 2025-04-06 04:00:06 +08:00
fix: issue of contextmenu in TabsView component; 🐛
修复:TabsView 组件右键菜单的bug;
This commit is contained in:
parent
1f26734a13
commit
107e08c08e
@ -4,8 +4,9 @@ module.exports = {
|
|||||||
color: '#13c2c2',
|
color: '#13c2c2',
|
||||||
mode: 'night'
|
mode: 'night'
|
||||||
},
|
},
|
||||||
|
multiPage: true,
|
||||||
animate: {
|
animate: {
|
||||||
name: 'zoom',
|
name: 'roll',
|
||||||
direction: 'left'
|
direction: 'default'
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -51,9 +51,10 @@ export default {
|
|||||||
...mapState('setting', ['multiPage', 'animate', 'layout'])
|
...mapState('setting', ['multiPage', 'animate', 'layout'])
|
||||||
},
|
},
|
||||||
created () {
|
created () {
|
||||||
this.pageList.push(this.$route)
|
const route = this.$route
|
||||||
this.linkList.push(this.$route.fullPath)
|
this.pageList.push(route)
|
||||||
this.activePage = this.$route.fullPath
|
this.linkList.push(route.fullPath)
|
||||||
|
this.activePage = route.fullPath
|
||||||
},
|
},
|
||||||
watch: {
|
watch: {
|
||||||
'$route': function (newRoute) {
|
'$route': function (newRoute) {
|
||||||
@ -61,7 +62,7 @@ export default {
|
|||||||
if (!this.multiPage) {
|
if (!this.multiPage) {
|
||||||
this.linkList = [newRoute.fullPath]
|
this.linkList = [newRoute.fullPath]
|
||||||
this.pageList = [newRoute]
|
this.pageList = [newRoute]
|
||||||
} else if (this.linkList.indexOf(newRoute.fullPath) < 0) {
|
} else if (this.linkList.indexOf(newRoute.fullPath) == -1) {
|
||||||
this.linkList.push(newRoute.fullPath)
|
this.linkList.push(newRoute.fullPath)
|
||||||
this.pageList.push(newRoute)
|
this.pageList.push(newRoute)
|
||||||
}
|
}
|
||||||
@ -89,8 +90,8 @@ export default {
|
|||||||
this.$message.warning('这是最后一页,不能再关闭了啦')
|
this.$message.warning('这是最后一页,不能再关闭了啦')
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
this.pageList = this.pageList.filter(item => item.fullPath !== key)
|
|
||||||
let index = this.linkList.indexOf(key)
|
let index = this.linkList.indexOf(key)
|
||||||
|
this.pageList = this.pageList.filter(item => item.fullPath !== key)
|
||||||
this.linkList = this.linkList.filter(item => item !== key)
|
this.linkList = this.linkList.filter(item => item !== key)
|
||||||
if (key == this.activePage) {
|
if (key == this.activePage) {
|
||||||
index = index >= this.linkList.length ? this.linkList.length - 1 : index
|
index = index >= this.linkList.length ? this.linkList.length - 1 : index
|
||||||
@ -99,8 +100,8 @@ export default {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
onContextmenu (e) {
|
onContextmenu (e) {
|
||||||
const pagekey = this.getPageKey(e.target)
|
const pageKey = this.getPageKey(e.target)
|
||||||
if (pagekey !== null) {
|
if (pageKey !== null) {
|
||||||
e.preventDefault()
|
e.preventDefault()
|
||||||
this.menuVisible = true
|
this.menuVisible = true
|
||||||
}
|
}
|
||||||
@ -148,16 +149,18 @@ export default {
|
|||||||
let index = this.linkList.indexOf(pageKey)
|
let index = this.linkList.indexOf(pageKey)
|
||||||
this.linkList = this.linkList.slice(index)
|
this.linkList = this.linkList.slice(index)
|
||||||
this.pageList = this.pageList.slice(index)
|
this.pageList = this.pageList.slice(index)
|
||||||
if (this.linkList.indexOf(this.activePage) < 0) {
|
if (this.linkList.indexOf(this.activePage) == -1) {
|
||||||
this.activePage = this.linkList[0]
|
this.activePage = this.linkList[0]
|
||||||
|
this.$router.push(this.activePage)
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
closeRight (pageKey) {
|
closeRight (pageKey) {
|
||||||
let index = this.linkList.indexOf(pageKey)
|
let index = this.linkList.indexOf(pageKey)
|
||||||
this.linkList = this.linkList.slice(0, index + 1)
|
this.linkList = this.linkList.slice(0, index + 1)
|
||||||
this.pageList = this.pageList.slice(0, index + 1)
|
this.pageList = this.pageList.slice(0, index + 1)
|
||||||
if (this.linkList.indexOf(this.activePage < 0)) {
|
if (this.linkList.indexOf(this.activePage) == -1) {
|
||||||
this.activePage = this.linkList[this.linkList.length - 1]
|
this.activePage = this.linkList[this.linkList.length - 1]
|
||||||
|
this.$router.push(this.activePage)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -124,7 +124,7 @@ for (let i = 0; i < 8; i++) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: 'analysis',
|
name: 'Analysis',
|
||||||
i18n: require('./i18n'),
|
i18n: require('./i18n'),
|
||||||
data () {
|
data () {
|
||||||
return {
|
return {
|
||||||
@ -133,7 +133,7 @@ export default {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
created() {
|
created() {
|
||||||
setTimeout(() => this.loading = !this.loading, 500)
|
setTimeout(() => this.loading = !this.loading, 1000)
|
||||||
},
|
},
|
||||||
components: {Trend, SalesData, HotSearch, RankingList, Bar, MiniProgress, MiniBar, MiniArea, ChartCard}
|
components: {Trend, SalesData, HotSearch, RankingList, Bar, MiniProgress, MiniBar, MiniArea, ChartCard}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user