【发布时间】:2023-03-31 05:14:03
【问题描述】:
我正在尝试为我的路由器链接名称传递道具,但它根本不起作用。我做错了什么?
按钮组件:
<template>
<router-link :to="{ name: nextStep }" tag="button" class="button">Back</router-link>
<router-link :to="{ name: previousStep }" tag="button" class="button">Next</router-link>
</template>
<script>
export default {
props: {
nextStep: {
type: String,
default: null,
},
previousStep: {
type: String,
default: null
}
},
}
</script>
当我使用组件时
<Buttons :nextStep="Firststep" :previousStep="Secondstep" />
和我的路由器 js 确保名称正确
{
path: "/firststep",
name: "Firststep",
component: FirstStep
},
{
path: "/secondstep",
name: "Secondstep",
component: SecondStep
},
【问题讨论】:
标签: javascript vue.js vuejs2