| | |
| | | // 导出路由 在 main.js 里使用 |
| | | const createRouter = () => |
| | | new Router({ |
| | | mode: "history", |
| | | mode: "hash", |
| | | // base: window.getServerJson.context, |
| | | scrollBehavior: () => ({ y: 0 }), |
| | | routes: constantRoutes |
| | |
| | | |
| | | |
| | | router.afterEach((to, from, next) => { |
| | | if ((to.path === "/overview/overviewList" || to.path === "/productManage/productList") && to.params.name) { |
| | | console.log(from, next) |
| | | to.meta.title = to.params.name |
| | | // document.title = to.meta.title |
| | | } else if (to.name === "inboundOutboundDetail") { |
| | | to.meta.title = "入库明细报表" |
| | | // document.title = to.meta.title |
| | | if(window.sessionStorage.getItem('routeName')){ |
| | | if(to.path === "/overview/overviewList"&&to.meta.title!="采购入库"){ |
| | | window.sessionStorage.setItem("routeName",to.params.name) |
| | | to.meta.title=to.params.name |
| | | }else if(to.meta.title==="采购入库"){ |
| | | to.meta.title = window.sessionStorage.getItem('routeName'); |
| | | } |
| | | }else{ |
| | | if ((to.path === "/overview/overviewList" || to.path === "/productManage/productList") && to.params.name) { |
| | | console.log(from, next) |
| | | window.sessionStorage.setItem("routeName",to.params.name) |
| | | to.meta.title = window.sessionStorage.getItem('routeName'); |
| | | // document.title = to.meta.title |
| | | } else if (to.name === "inboundOutboundDetail") { |
| | | to.meta.title = "入库明细报表" |
| | | // document.title = to.meta.title |
| | | }else{ |
| | | // window.sessionStorage.removeItem("routeName") |
| | | } |
| | | } |
| | | }) |
| | | }); |
| | | // router.beforeEach((to, from, next) => { |
| | | // must call `next` |
| | | // console.log(to, from) |