请稍等 ...
×

采纳答案成功!

向帮助你的同学说点啥吧!感谢那些助人为乐的人

ShelfGroupDialog组件

老师你好,我在复制ShelfGroupDialog.vue后,终端就会有警告,

error: The 'categoryList' variable inside 'v-for' directive should be replaced with a computed property that returns filtered array in
stead. You should not mix 'v-for' with 'v-if' (vue/no-use-v-if-with-v-for) at src\components\shelf\ShelfGroupDialog.vue:9:12:
   7 |            :key="index"
   8 |            @click="onGroupClick(item)"
>  9 |            v-if="(item.edit === 2 && isInGroup) || item.edit !== 2 || !item.edit">
     |            ^
  10 |         <div class="dialog-list-item-text">{{item.title}}</div>
  11 |         <div class="dialog-list-icon-wrapper" v-if="category && item.id ? category.id === item.id : false">
  12 |           <span class="icon-check"></span>

正在回答 回答被采纳积分+3

插入代码

1回答

Sam 2019-08-06 19:36:30

hi,这个警告是建议你把v-for中的categoryList换成computed计算属性

0 回复 有任何疑惑可以回复我~
  • 提问者 whis_per #1
    categoryList是在computed中的,错误好像出在v-if那里
    回复 有任何疑惑可以回复我~ 2019-08-06 19:41:24
  • Sam 回复 提问者 whis_per #2
    嗯,看到了,Vue不建议同时使用v-for和v-if,你的DOM里是不是同时使用了v-for和v-if?
    回复 有任何疑惑可以回复我~ 2019-08-06 22:37:35
  • 提问者 whis_per 回复 Sam #3
    是的,但是老师的就是这样啊。。我也不敢改
    回复 有任何疑惑可以回复我~ 2019-08-06 23:13:49
问题已解决,确定采纳
还有疑问,暂不采纳
微信客服

购课补贴
联系客服咨询优惠详情

帮助反馈 APP下载

慕课网APP
您的移动学习伙伴

公众号

扫描二维码
关注慕课网微信公众号