报错 The "tem.children’ expression inside ‘-for directive should be replaced with a computed property that retums fitered array instead, You should not mx -for’ with ‘v-if’.
原因:
v-for的优先级比v-if高,因此v-if会重复运行在每个v-for中
解决方案:
使用template标签进行包裹
报错的代码
<sidebar-item
v-if="child.id != 347"
v-for="child in item.children"
:key="child.path"
:is-nest="true"
:item="child"
:base-path="resolvePath(child.path)"
class="nest-menu"
/>
解决后的代码
<template v-for="child in item.children">
<sidebar-item
v-if="child.id != 347"
:key="child.path"
:is-nest="true"
:item="child"
:base-path="resolvePath(child.path)"
class="nest-menu"
/>
</template>