我正在使用Bootstrap,以下不起作用:
<tbody>
<a href="#">
<tr>
<td>Blah Blah</td>
<td>1234567</td>
<td>£158,000</td>
</tr>
</a>
</tbody>
Run Code Online (Sandbox Code Playgroud) 我们可以使用任何其他标记在<ul>
伴随着<li>
?
喜欢
<ul>
Some text here or <p>Some text here<p> etc
<li>item 1</li>
Some text here or <p>Some text here<p> etc
<li>item 1</li>
</ul>
Run Code Online (Sandbox Code Playgroud) 我想使用Vue渲染一个包含行的表,但是将单元格作为一个组件.
我已经做了一个我希望看到的最终结果的例子,并且有一些代码与我认为我可以解决这个问题有关:
HTML
<div id="app">
<table>
<thead>
<tr>
<th>Row</th>
<th>ID</th>
<th>Name</th>
<th>Age</th>
</tr>
</thead>
<tbody>
<tr v-for="(row, rindex) in people">
<td>{{ rindex }}</td>
<cell v-for="(value, vindex, rindex) in row" :value="value" :vindex="vindex" :rindex="rindex"></cell>
</tr>
</tbody>
</table>
<template id="template-cell">
<td>{{ value }}</td>
</template>
</div>
Run Code Online (Sandbox Code Playgroud)
JS
// Register component
Vue.component('cell', {
template: '#template-cell',
name: 'row-value',
props: ['value', 'vindex', 'rindex']
// In here I would like to access value, vindex and rindex
});
// Start application
new Vue({
el: '#app', …
Run Code Online (Sandbox Code Playgroud)