I Pass an Array of data to a custom component in Vue js and want to have it in a that is defined in my template, but I get an error of Missing required prop: "students". here is my code.
custom Component:
customElements.define('students-list', defineCustomElement({
template: `<ul :classes="classes">
<li v-for="st in students"
:key="st.name">
{{ st.name }}
</li>
</ul>
</div>`,
props: {
classes: {
type: String,
required: true,
},
students: {
type: Array,
required: true
}
},
data() {
return {
}
}
}));
and the code I use to call it is:
<students-list classes="col-sm-12" :students = "[{name: 'John'},{name: 'Sarah'},{name: 'Dave'}]"></students-list>
students-listsomewhere else in your code, where you are not passing an array ofstudents?