I have a create button above my table, I’m trying to render dynamic :to
v-bind
Since I have access to {{title}}
Ex. {{title}} = apple, orange, any string
I’ve tried
<router-link :to=`${title}/create`> <v-btn color="blue white--text mt-5 mr-8"> <span>Create</span> </v-btn> </router-link>
I get
Try #2
to=”{title}/create”
link redirect wrong!
http://localhost:8080/%7Btitle%7D/create
Try #3
to=”{{title}}/create”
crashed !!
Advertisement
Answer
<router-link :to="`${title}/create`"> <v-btn color="blue white--text mt-5 mr-8"> <span>Create</span> </v-btn> </router-link>
vue-directives are ALWAYS wrapped with double-quotes, even if you are using template literal