Подскажите, как преобразовать?
<th v-repeat="options.cols">{{$index}}</th>
в
<th v-for="options.cols">{{$index}}</th>
Должно заполнить заголовки от 0 до 4.
Спасибо.
var grid = new Vue({
el: "#grid",
data: {
options: {
rows: 5,
cols: 5
}
}
});
<script src="https://cdnjs.cloudflare.com/ajax/libs/vue/2.5.16/vue.min.js"></script>
<div id="grid">
<table>
<thead>
<!-- КАК ПРЕОБРАЗОВАТЬ? ?? -->
<th v-repeat="options.cols">{{$index}}</th>
<!-- <th v-for="options.cols">{{$index}}</th> -->
</thead>
</table>
</div>
Смотрим документацию.
new Vue({
el: '#root',
data: {
cols: 5
}
});
<script src="https://cdnjs.cloudflare.com/ajax/libs/vue/2.5.16/vue.min.js"></script>
<div id='root'>
<div v-for="(i, _i) in cols" :key="_i">{{ i }}, {{ _i }}</div>
</div>
он начал менять лишь справа налево и наоборот