0đź‘Ť
Your navigation
component doesn’t have a method called setLink
, but you are referencing a setLink
method in that component’s template. That’s why you’re getting that error.
If you’re trying to change the main component’s currentView
property, you can instead emit an event (say changeView
) from the navigation
component when a link is clicked:
<div v-on:click="$emit('changeView', 'someLink')"></div>
Then, listen for that event in the main component’s scope, on the tag for your navigation
component:
<navigation v-on:changeView="setLink($event)"></navigation>
Here, the $event
variable is what got sent as the value of the changeView
event ('someLink'
in the example).
- [Vuejs]-In Vue.js, how do I enable buttons in a v-for loop when an input is changed?
- [Vuejs]-How to create the perfect autosize textarea?
Source:stackexchange.com