vue.js

关注公众号 jb51net

关闭
首页 > 网络编程 > JavaScript > javascript类库 > vue.js > vue中v-for循环数字,index从0开始

vue中v-for循环数字,index从0开始的实现方式

作者:小泡泡c

这篇文章主要介绍了vue中v-for循环数字,index从0开始的实现方式,具有很好的参考价值,希望对大家有所帮助,如有错误或未考虑完全的地方,望不吝赐教

vue中v-for循环数字,index从0开始

1. 循环数字

// 写法一
<a-select style="width: 120px">
 <a-select-option :value="index" v-for="index in 14" :key="index"> {{index}}级   </a-select-option>
</a-select>

// 写法二
<a-select style="width: 120px">
 <a-select-option :value="index" v-for="index of 14" :key="index"> {{index}}级   </a-select-option>
</a-select>

2. index 从 0开始

<a-select style="width: 120px" >
 <a-select-option :value="index" v-for="(n,index) in 14" :key="index"> {{index}}级 </a-select-option>
</a-select>

总结

以上为个人经验,希望能给大家一个参考,也希望大家多多支持脚本之家。

您可能感兴趣的文章:
阅读全文