解决Vue报错:[Vue warn]: 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.”
一、问题产生原因
因为是在template
包裹的最外层div
上使用了v-if
、当不渲染时、不符合VUE语法。
<template>
<div class="text-style" v-if="show">
请。。。。。。。。
</div>
</template>
二、解决办法
<template>
<div> // 在最外层添加一层 div
<div class="text-style" v-if="show">
请。。。。。。。。
</div>
</div>
</template>