vue component, cuts the string into an array and then loops the output results and reports an error
I want to get the following data
#1岁-2岁 #breakfast #快手
var test = "1 year old-2 years old, breakfast, fast hand";
<cook-tag :tags="test" />
Vue.component("cook-tag", {
template: "<span class='tag-item' v-for='item in list'>#{{item}}</span>",
data() {
return {
list:[],
}
},
props: ["tags"],
created(){
this.list = this.tags.split(",") || [];
},
})
Component template can only have one parent element, and span needs to be wrapped