模板字符串只使用反引號(hào),但你的字符串同時(shí)使用了單引號(hào)和反引號(hào)。
替換值(route.params.id
)引用了一個(gè)在你的示例中似乎未定義的route
變量。我認(rèn)為你想要訪問this.$route
,所以實(shí)際的替換應(yīng)該是this.$route.params.id
items
數(shù)組應(yīng)該像這樣:
export default { data() { return { items: [ { title: 'List User', url: `/user/function/listUser/${this.$route.params.id}` }, { title: 'structure User', url: `/user/function/structUser/${this.$route.params.id}` } ] } } }
這是一個(gè)例子
`/user/function/structUser/${this.$route.params.id}`
另外,也許嘗試在一個(gè)computed
中使用它,因?yàn)樗赡懿皇怯?jì)算屬性。