Vue.js RouterLink在Vue Js中未正确显示
我在Vue Js中使用routerLink时遇到问题。它只显示localhost:8080/#/purchase orders。它应该是localhost:8080/#/purchaseorders/2,因为我添加了params属性。我该如何解决这个问题Vue.js RouterLink在Vue Js中未正确显示,vue.js,vuejs2,vue-router,element-ui,Vue.js,Vuejs2,Vue Router,Element Ui,我在Vue Js中使用routerLink时遇到问题。它只显示localhost:8080/#/purchase orders。它应该是localhost:8080/#/purchaseorders/2,因为我添加了params属性。我该如何解决这个问题 <el-table-column fixed="right" property="action"
<el-table-column
fixed="right"
property="action"
label="Action"
width="120">
<template slot-scope="scope">
<router-link :to="{ path: '', params: { id: 2 }}">
<el-button type="text" size="small">Detail</el-button>
</router-link>
<el-button type="text" size="small">Edit</el-button>
</template>
</el-table-column>
细节
编辑
如果使用路径,则忽略参数。
您需要改用名称
它应该是这样的:(假设订单是路线的名称)
或者,如果要使用路径,则必须提供完整路径
注意:如果提供了路径,则会忽略参数,而对于查询来说,情况并非如此,如上面的示例所示。相反,您需要提供路由的名称,或使用任何参数手动指定整个路径:
你能告诉我你对路线的定义吗?(通常是router.js)路由正在运行。当我在url中键入某个内容时,它将处于导航状态。问题只出在那个按钮上
<router-link :to="{ name: 'orders', params: { id: 2 }}">