最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

vuejs3 - Why index variable in for construction is invalid? - Stack Overflow

programmeradmin2浏览0评论

I have Laravel 10 / vuejs 3 app I try to use index variable in for construction :

<tr v-for="(cartItem, index) in cartItems" :key="cartItem.id">
    <td class="px-4 py-3">index::{{ index }};; {{ cartItem.id }}

to remove element by this index :

function removeFromItems(index) {
    cartItems.splice(index, 1)
    ...

        

But I see on the page that index equals cartItem.id, so deleting does not work properly.

What is wrong ?

发布评论

评论列表(0)

  1. 暂无评论