error The 'arr' variable inside 'v-for' directive should be replaced with a

1,062 阅读1分钟

如图所示

vue中v-forv-if写在一起会出现报错

v-if
error

解决方法

  1. 可以改成v-show,控制显示隐藏
    v-show
  2. 实在要用v-if的话,可以选择用template占位标签多包裹一层
    template