im使用此解决方案动态设置vuejs组件中的表格单元格:
http://forum.vuejs.org/topic/526/repeating-table-row-with-slot
这只适用于Vue.JSV1.0.10,但不适用于当前版本v1.0.26.
Jsfiddle:https://jsfiddle.net/peL8fuz3/
我正在try 获取以下标记(item对象应该在组件中可用)
<div id="vue">
<basic-table>
<table-cell>{{ item.id }}</table-cell>
<table-cell>{{ item.title }}</table-cell>
</basic-table>
</div>
Vue.js组件(更多细节)
Vue.component('basic-table', {
template: '<table><tbody><tr v-for="item in collection" v-slot></tr></tbody></table>',
data: function () {
return {
collection: [
{id: 1, title: 'Vue'},
{id: 2, title: 'Vue 2'},
{id: 3, title: 'Vue 3'},
{id: 4, title: 'Vue 4'},
]
}
}
});
有人知道怎么解决这个问题吗?
Edit