面包屑跳转

master
wyj2080 6 years ago
parent b321a97617
commit 185e7800e9

@ -28,3 +28,10 @@ new Vue({
}).$mount('#app') }).$mount('#app')
//重复点击同一个报错解决
import Router from 'vue-router'
const routerPush = Router.prototype.push
Router.prototype.push = function push(location) {
return routerPush.call(this, location).catch(error=> error)
}

@ -143,6 +143,7 @@
import customerView from "../services/datacenter/customerView"; import customerView from "../services/datacenter/customerView";
export default { export default {
inject:['setMenuName'],
data() { data() {
return { return {
userId: JSON.parse(sessionStorage.getItem("loginInfo")).userId, userId: JSON.parse(sessionStorage.getItem("loginInfo")).userId,
@ -362,6 +363,7 @@
}, },
//广 //广
zeroExtendMore: function () { zeroExtendMore: function () {
this.setMenuName("首页","推广为0店铺数");
let that = this; let that = this;
this.$router.push({ this.$router.push({
path: '/zero/extend/detail', path: '/zero/extend/detail',

@ -31,7 +31,7 @@
<!-- <Header :style="{background: '#fff', boxShadow: '0 2px 3px 2px rgba(0,0,0,.1)'}"></Header>--> <!-- <Header :style="{background: '#fff', boxShadow: '0 2px 3px 2px rgba(0,0,0,.1)'}"></Header>-->
<Content :style="{padding: '0 16px 16px'}"> <Content :style="{padding: '0 16px 16px'}">
<Breadcrumb :style="{margin: '16px 0'}"> <Breadcrumb :style="{margin: '16px 0'}">
<BreadcrumbItem>{{selectedMenu}}</BreadcrumbItem> <BreadcrumbItem><span style="cursor: pointer" @click="breadcrumbClick">{{selectedMenu}}</span></BreadcrumbItem>
<BreadcrumbItem>{{selectedSubMenu}}</BreadcrumbItem> <BreadcrumbItem>{{selectedSubMenu}}</BreadcrumbItem>
</Breadcrumb> </Breadcrumb>
<Card> <Card>
@ -51,10 +51,12 @@
provide() { provide() {
return { return {
checkParamBlank: this.checkParamBlank, checkParamBlank: this.checkParamBlank,
setMenuName: this.setMenuName,
}; };
}, },
data() { data() {
return { return {
mainUrl: "/customer/view",
isCollapsed: false, isCollapsed: false,
mHeight: 600, mHeight: 600,
selectedItemName: null, selectedItemName: null,
@ -71,6 +73,8 @@
twoPermissionList: [], twoPermissionList: [],
//3 //3
threePermissionList: [], threePermissionList: [],
//
breadcrumbUrl: "",
} }
}, },
mounted() { mounted() {
@ -127,6 +131,7 @@
if (cItem.id === val) { if (cItem.id === val) {
this.selectedMenu = item.name; this.selectedMenu = item.name;
this.selectedSubMenu = cItem.name; this.selectedSubMenu = cItem.name;
this.breadcrumbUrl = cItem.resource;
} }
} }
} }
@ -239,12 +244,14 @@
} }
}) })
}, },
// //
menuInit: function () { menuInit: function () {
let that = this; let that = this;
// //
that.selectedItemName = 0; that.selectedItemName = 0;
this.$router.push({path: "/customer/view"}); this.$router.push({path: that.mainUrl});
this.selectedMenu = "首页";
this.breadcrumbUrl = this.mainUrl;
// that.selectedItemName = that.onePermissionList[0].subMenuList[0].id; // that.selectedItemName = that.onePermissionList[0].subMenuList[0].id;
// that.openName = [that.onePermissionList[0].id]; // that.openName = [that.onePermissionList[0].id];
// this.$nextTick(() => { // this.$nextTick(() => {
@ -273,6 +280,18 @@
this.$nextTick(() => { this.$nextTick(() => {
that.$refs.menu.updateActiveName(); that.$refs.menu.updateActiveName();
}) })
},
//
setMenuName: function (menu1, menu2) {
this.selectedMenu = menu1;
this.selectedSubMenu = menu2;
},
//
breadcrumbClick: function () {
if(this.selectedMenu === "首页"){
this.selectedSubMenu = "";
}
this.$router.push(this.breadcrumbUrl);
} }
}, },

Loading…
Cancel
Save