在Vue.JS我有
data() {
return {
name: 'John',
sentence: "Hi my name is {{ name }}",
};
},
在我的HTML里
<h2>{{ sentence}}</h2>
但输出是
嗨我的名字是{{ name }
{{name}}并没有被取代。我采用这种方法是因为用户可以从db中获取不同的句子,因此名称必须是动态可变的。
我动态地创建组件:
<component is="tab"/>
如何为该组件添加道具?我试着:
<component is="tab" my-props="test" />
我在控制台出错了:
[Vue warn]: Attribute "type" is ignored on component <component> because the component is a fragment instance: http://vuejs.org/guide/components.
我的vue js数据有一些数组,在模板中,我试图使用v-for循环来呈现它们。
类似于:
<tr v-for="d in [0,1,2,3]"><td>{{data.people[d].name}}</td></tr>
<tr v-for="d in [0,1,2,3]"><td>{{data.places[d].name}}</td></tr>
<tr v-for="d in [0,1,2,3]"><td>{{data.ord