问题描述:
在使用vue的时候,我们因为常用v-if改变了页面的DOM结构,可能会遇见这样的告警信息,并且页面会被卡主,需要刷新才可以解决;错误告警如下:

    Error in nextTick: "NotFoundError: Failed to execute 'insertBefore' on 'Node': The node before which the new node is to be inserted is not a child of this node."

错误代码:
在这里插入图片描述

问题解决:

    我在网上找了一些,有说是使用v-show代替v-if即可。
    但是我这边的代码是不能用v-show的,用v-show我也试过了,v-if写的判断条件会导致v-show不支持。
    我的解决方案是在template外层再套一层div,如下图所示:

在这里插入图片描述

Logo

Vue社区为您提供最前沿的新闻资讯和知识内容

更多推荐