为了账号安全,请及时绑定邮箱和手机立即绑定

vue.js 的 v-for列表渲染问题

vue.js 的 v-for列表渲染问题

暴躁的代码 2017-06-13 11:04:31
<tbody id="show-blog-type-module" onclick="return clickTr(event)" > <tr v-for="(blogType,index) in blogTypes"> <td>{{index++}}</td> <td>{{blogType.id}}</td> <td>{{blogType.name}}</td> <td>{{blogType.detail}}</td> <td>{{blogType.blogs.length}} <a class="pointer" v-on:click="showBlogs"> <span class="glyphicon glyphicon-resize-full"></span> </a> </td> <td> <a class="pointer"> <span class="glyphicon glyphicon-edit"  title="编辑"></span> </a> </td> <td> <a :href="'manager/blogType/delete?id='+blogType.id"> <span class="glyphicon glyphicon-trash" title="删除"></span> </a> </td> <td> <a :href="'blog/type?id='+blogType.id"> <span class="glyphicon glyphicon-link" title="浏览"></span> </a> </td> </tr>     </tbody>我想在这个循环的tr中做一个手风琴的效果,如果想在表格中用v-for一次渲染两列<xxx v-for="(blogType,index) in blogTypes">     <tr></tr>     <tr></tr> </xxx>但是这样会vue报错 v-for 不会渲染应为浏览器识别不了xxx标签。敢问各位大侠有什么好方法吗?
查看完整描述

1 回答

已采纳
?
woshiajuana

TA贡献211条经验 获得超152个赞

使用template标签看看

<template v-for="(blogType,index) in blogTypes">
    <tr></tr>
    <tr></tr>
</template>


查看完整回答
2 反对 回复 2017-06-13
  • 1 回答
  • 0 关注
  • 2977 浏览
慕课专栏
更多

添加回答

举报

0/150
提交
取消
意见反馈 帮助中心 APP下载
官方微信