同一标签上,不能同时使用v-for和v-if,怎么办?
解决方案
将 v-for 写在 template上,key和 v-if 写在循环遍历的元素上
(template上不能使用key, 但 v-for 必须要指定key,所以循环遍历的元素上,需要加上key )
同一标签上,不能同时使用v-for和v-if,怎么办?
解决方案
将 v-for 写在 template上,key和 v-if 写在循环遍历的元素上
(template上不能使用key, 但 v-for 必须要指定key,所以循环遍历的元素上,需要加上key )
的,如果同时使用,那么每次渲染都会先循环再进行条件判断造成性能的浪费。指令用于条件性地渲染一块内容。这块内容只会
html><html lang="en"><head
v if v for v bind v on 案例整合
```html Document {{v + ' ' + k + ' ' + i}} ```
举报文章
请选择举报类型
补充说明
0/200
上传截图
格式支持JPEG/PNG/JPG,图片不超过1.9M