原由:
在進行項目開發的時候因為在一個標簽上同時使用了v-for和v-if兩個指令導致的報錯。
提示錯誤:The 'undefined' variable inside 'v-for' directive should be replaced with a computed property that returns filtered array instead. You should not mix 'v-for' with 'v-if'
?原因:v-for的優先級會高于v-if,因此v-if會重復運行在每個v-for中。
正確寫法:使用template標簽進行包裹(template為html5的新標簽,無特殊含義)
?
?注意點:key值寫在包裹的元素中