我想在一个范围内迭代表中的行。但我看到的所有例子都说明了如何对常数进行计算,例如,
<div> <span v-for="n in 10">{{ n }} </span> </di
对于这样一个变量,我该怎么做呢,
<table> <tr v-for="(el, index) in form.repeat" :key="index"> <td>hello</td> </tr> </table>
谢谢
在数据部分:
data: () => ({'num_pis': 0})
在模板部分,引用编号。这只是一个片段,我使用的是Vuetify的v-data-table。
<template slot="items" slot-scope="props"> <td class="table-content-style">{{ props.item.metric_name }}</td> <td v-for="i in num_pis"> {{ props.item[i] }} </td> </template>
Codepen Example