1.vue this.$router.push(’./map’);无法跳转的问题
<template>
<div style="text-align: center">
<el-button type="primary" style="margin-top: 40vh" @click="onLogin">登录</el-button>
</div>
</template>
<script>
export default {
name: 'login',
data ()
return {
}
},
methods: {
onLogin:function () {
this.$router.push('./map');
}
},
}
</script>
<style scoped>
</style>
router中是这样引入的
import map from '@components/map'
点击事件无法跳转
2.解决方法:
改变引入方式
import map=r=>require.ensure([],()=>(require('../components/map')),'map')
这样通过静态引入就没问题了