mirror of
https://gitee.com/gz-yami/mall4v.git
synced 2026-03-22 08:07:17 +08:00
解决路由重复跳转报错&修改版本号
This commit is contained in:
@@ -7,7 +7,7 @@
|
|||||||
<link rel="icon" href="<%= BASE_URL %>favicon.ico">
|
<link rel="icon" href="<%= BASE_URL %>favicon.ico">
|
||||||
<title><%= htmlWebpackPlugin.options.title %></title>
|
<title><%= htmlWebpackPlugin.options.title %></title>
|
||||||
<script>
|
<script>
|
||||||
console.log('mall4j.v230313')
|
console.log('mall4j.v230320')
|
||||||
</script>
|
</script>
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
|
|||||||
@@ -12,6 +12,17 @@ import { isURL } from '@/utils/validate'
|
|||||||
import { clearLoginInfo } from '@/utils'
|
import { clearLoginInfo } from '@/utils'
|
||||||
|
|
||||||
Vue.use(Router)
|
Vue.use(Router)
|
||||||
|
// 解决路由重复跳转报错
|
||||||
|
const originalPush = Router.prototype.push
|
||||||
|
const originalReplace = Router.prototype.replace
|
||||||
|
// 修改原型对象中的push函数
|
||||||
|
Router.prototype.push = function push (location) {
|
||||||
|
return originalPush.call(this, location).catch(err => err)
|
||||||
|
}
|
||||||
|
// 修改原型对象中的replace函数
|
||||||
|
Router.prototype.replace = function replace (location) {
|
||||||
|
return originalReplace.call(this, location).catch(err => err)
|
||||||
|
}
|
||||||
|
|
||||||
// 开发环境不使用懒加载, 因为懒加载页面太多的话会造成webpack热更新太慢, 所以只有生产环境使用懒加载
|
// 开发环境不使用懒加载, 因为懒加载页面太多的话会造成webpack热更新太慢, 所以只有生产环境使用懒加载
|
||||||
const _import = require('./import-' + process.env.NODE_ENV)
|
const _import = require('./import-' + process.env.NODE_ENV)
|
||||||
|
|||||||
Reference in New Issue
Block a user