I have a vue component to render nav list, and pass nav list, each item includes title and link:
<template>
<ul>
<li v-for="item in list"><a v-link="{{ path: item.link }}"></a></li>
</ul>
</template>
<script>
export default {
props: ['list']
}
</script>
I try pass variable item.link
to v-link path, but failed.
get this warn:
[Vue warn]: v-link="{{ path: item.link }}": attribute interpolation is not allowed in Vue.js directives and special attributes.
what should i do if pass variable to v-link path?
thanks for reading :)
To specify the type of prop you want to use in Vue, you will use an object instead of an array. You'll use the name of the property as the key of each property, and the type as the value. If the type of the data passed does not match the prop type, Vue sends an alert (in development mode) in the console with a warning.
I used the following with vue-router 2.x:
<router-link :to="{path: '/applications/' + currentApplicationId}" class="nav-link">Overview</router-link>
More documentation can be found here.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With