增加路由搜索功能 左侧菜单栏增加图标

This commit is contained in:
pixel
2020-05-28 22:08:26 +08:00
parent f2a0f9776d
commit 7b52618f53
4 changed files with 200 additions and 152 deletions
@@ -36,15 +36,15 @@ export default {
left: 0,
top: 0,
isCollapse: false,
isMobile:false,
isMobile: false,
rightActive: ''
}
},
created() {
this.$bus.on('mobile',(isMobile)=>{
this.$bus.on('mobile', isMobile => {
this.isMobile = isMobile
})
this.$bus.on('collapse',(isCollapse)=>{
this.$bus.on('collapse', isCollapse => {
this.isCollapse = isCollapse
})
const initHistorys = [
@@ -60,7 +60,7 @@ export default {
this.setTab(this.$route)
},
beforeDestroy(){
beforeDestroy() {
this.$bus.off('collapse')
this.$bus.off('mobile')
},
@@ -77,7 +77,7 @@ export default {
} else {
width = 220
}
if(this.isMobile){
if (this.isMobile) {
width = 0
}
this.left = e.clientX - width
@@ -118,7 +118,7 @@ export default {
const activeIndex = this.historys.findIndex(
item => item.name == this.activeValue
)
this.historys.splice(leftIndex+1, this.historys.length)
this.historys.splice(leftIndex + 1, this.historys.length)
if (leftIndex < activeIndex) {
this.$router.push({ name: this.rightActive })
}
@@ -202,4 +202,9 @@ export default {
background: #f2f2f2;
cursor: pointer;
}
.router-history {
background: #fff;
padding: 0 6px;
border-top: 1px solid #dcdcdc;
}
</style>