对于php等vuejs中的循环
在 vuejs 中,vor
像 php 这样的循环吗?
我想要此输出:
<select>
<option>2</option>
<option>1</option>
<option>0</option>
</select>
我的代码(ticket.quantity = 2):
<select>
<option v-for="index in ticket.quantity" :value="index" :key="index">{{index}}</option>
</select>
我的输出:
<select>
<option>2</option>
</select>
It is possible in vuejs to v-for
a loop like php?
I want this output:
<select>
<option>2</option>
<option>1</option>
<option>0</option>
</select>
My code (ticket.quantity = 2):
<select>
<option v-for="index in ticket.quantity" :value="index" :key="index">{{index}}</option>
</select>
My output:
<select>
<option>2</option>
</select>
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您可以尝试循环
ticket.quantity + 1
:You can try to loop
ticket.quantity + 1
:尼古拉的答案对我没有完全工作,但我设法解决了:
The answer of Nikola didn't worked for me completely but I managed to solve it like this: