最近、vuejs の計算オプションが原因である問題に遭遇しました。
まず、v-for を使用して、computed オプションによって作成される配列 (soloColImgs) をループします。
私のHTML
<div class="show-box" v-for="item in soloColImgs" track-by="$index">
<img v-bind:src="item.imgUrl"/>
<a v-bind:href="item.itemUrl" target="_blank"></a>
</div>
私のJS
//...
computed: {
soloColImgs :function(){
//....
},
methods: {
change:function(){
this.soloColImgs.pop();
}
}
pop()
次に、またはなどを使用して配列 (soloColImgs) を変更します。splice()
コンソールを見ると、それに応じて配列が変更される可能性がありますが、DOMはまったく変更されません。誰かがこれから私を助けることができれば、それは素晴らしいことです.