code show as below:
Vue.component('child-i',{
props:['msg','datato'],
template:'<h1>{{msg.title}}</h1>'+
'<table>'+
'<tbody>'+
'<tr v-for="to in todata" :datato="to">'+
'<td>{{datato.tile1}}</td>'+
'<td>{{datato.tile2}}</td>'+
'<td>{{datato.tile3}}</td>'+
'</tr>'+
'</tbody>'+
'</thead>'
});
Second code
var datas = new Vue({
el:"#app",
data:{
parameter:{title:"hello vue js"},
todata:[{
tile1:"aaa",
tile2:"www",
tile3:"sss",
},{
tile1:"aaa",
tile2:"www",
tile3:"sss",
},{
tile1:"aaa",
tile2:"www",
tile3:"sss",
}]
}
});
HTML
<p id="app" >
<child-i :msg="parameter"></child-i>
</p>
In fact, what I want to do is very simple. I want to use the v-for instruction to dynamically construct a set of tr and td table tags inside the subcomponent. When I run it, the browser does not report an error, but there is no error in the tag. Any tags about tr and td, did I write them wrong? , I hope the master can give some advice or provide a demo for reference
You have already sent the msg and also the todata...
HTML
JS