「Vue」程序式路由导航用法

1、button发起点击请求
<mt-button type='primary' size='large' plain @click="topdcmt(id)">商品评论</mt-button>
2、methods定义方法
topdcmt(id){this.$router.push({ name: 'pdcmt', params: { userId: id } })}
3、router.js定义导航路径
import Pdcmt from './components/product/productcomment.vue'
{path: '/home/productcomment/:id',component: Pdcmt,name:'pdcmt'},

posted @ 2019-03-09 10:23  子谦0618  阅读(135)  评论(0编辑  收藏  举报