美文网首页mpvue
mpvue项目集成mpvue-router-patch插件实现路

mpvue项目集成mpvue-router-patch插件实现路

作者: 程序员三千_ | 来源:发表于2020-01-07 14:18 被阅读0次

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')是跳转到下个页面,并且关闭当前页面。

相关文章

网友评论

    本文标题:mpvue项目集成mpvue-router-patch插件实现路

    本文链接:https://www.haomeiwen.com/subject/zyvractx.html