I want to get the user ID, so I have a dropdown button =
list {{item.title}}
And this data:
My intention is to send the user ID. This way, I can actually get
viaroute.params.id url: ''/user/function/structUser/${route.params.id}`' Not working, what did I do wrong?
The template string only uses backticks, but your string uses both single quotes and backticks.
replacement value (
route.params.id) refers to aroutevariable that appears to be undefined in your example. I think you want to accessthis.$route, so the actual replacement should bethis.$route.params.iditemsThe array should look like this: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}` } ] } } }Demo
This is an example
`/user/function/structUser/${this.$route.params.id}`Also, maybe try using it inside a
computedas it may not be a computed property.