github
地址:https://github.com/F-loat/mpvue-router-patch
安裝依賴
cnpm i -S mpvue-router-patch
在main.js里安裝插件
import MpvueRouterPatch from 'mpvue-router-patch'
Vue.use(MpvueRouterPatch)
在頁面使用
<template>
<div>
<div class="text">
ibook
</div>
<van-button type="primary" @click="jump">按鈕</van-button>
</div>
</template>
<script>
export default {
methods:{
jump(){
this.$router.push('/pages/index/main')
}
}
}
</script>
<style lang="scss" scoped>
.text{
color: red;
}
</style>
至此,路由跳轉插件就集成完畢了
注意
1、this.$router.push('/pages/index/main')是跳轉到下個頁面比勉,不關閉當前頁面琐馆。
2不翩、this.$router.replace('/pages/index/main')是跳轉到下個頁面盟戏,并且關閉當前頁面咖杂。
作者:_小三爺
鏈接:http://www.reibang.com/p/356e318bca83
來源:簡書
著作權歸作者所有肛循。商業(yè)轉載請聯(lián)系作者獲得授權铭腕,非商業(yè)轉載請注明出處。