vue.js为什么在component的template的root标签中不能使用v-for
1个回答
展开全部
这样写试试,v-for不能用于根元素(root element)
<template v-for="article in articles">
<div style="margin:13px">
<div class="article-image">
<a>
<img :src="article.image_path"/>
</a>
</div>
<div class="article-title">
<h4>{{article.title}}</h4>
</div>
<div class="article-content">
<p v-html="article.content"></p>
</div>
</div>
</template>
<template v-for="article in articles">
<div style="margin:13px">
<div class="article-image">
<a>
<img :src="article.image_path"/>
</a>
</div>
<div class="article-title">
<h4>{{article.title}}</h4>
</div>
<div class="article-content">
<p v-html="article.content"></p>
</div>
</div>
</template>
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询