Answer the question
In order to leave comments, you need to log in
Data in Vue.component?
Hello!
Need advice and help.
There is a markup:
<nav id="navbar">
<navigation></navigation>
<p>Hello, World!</p>
<other-components></other-components>
</nav>
Vue.component('navigation', {
props: ['val'],
data() {
return {
navlist: [
{ id: 'name-1', name: 'linkName-1'},
{ id: 'name-2', name: 'linkName-2'},
{ id: 'name-3', name: 'linkName-3'},
{ id: 'name-4', name:' linkName-4'},
{ id: 'name-5', name: 'linkName-5'}
]
}
},
template: `
<template v-for="val in navList" :key="val.id" :val="val">
<ul>
<li>
<a :href=val.id :title=val.name>{{ val.name }}</a>
</li>
</ul>
</template>`
})
new Vue({ el: '#navbar' })
<p>Hello, World!</p>
disappears. Answer the question
In order to leave comments, you need to log in
1. What does it mean to register? where to register? where to register? what are you talking about? give an example. You can make at least ten instances per page.
2. some kind of nonsense. why can't that? you pass the component config to .component(). the data option is part of the config.
but does not contain datacontains , like both the date and the template are
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question