vue v-for 和 v-if 、v-else一块儿使用形成的bug

现象:致使v-else 执行v-for的length次数,vi

从现象看应该v-for先解析,而后将v-if和v-else包在其中解决方案

 

解决方案:很简单,tempalte 将v-if v-else 隔离到最外层tempalte

<template vi-if>

< v-for>

</template>

<template v-else>

</template>

如此就不会有很奇怪的问题了

相关文章
相关标签/搜索