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

alpine.js - Data not refreshing inside template in Alpine JS - Stack Overflow

programmeradmin0浏览0评论

For some reason the list is not updating. Any ideas why? The function is called and the entry is removed properly. But it keeps on showing the old list along with the removed entry.

(I have not included the code, wherein the users list in populated at init).

<div x-data="{ users: {} }">
   <template x-for="user in users" :key="user.id">
      <div x-show="user && !user.err" class="">
         <span x-show="user.name" x-text="user.name"></span>
         <button x-show="user.name" @click="this.users = removeUser(user.id)">
            <svg></svg>
         </button>
      </div>
  </template>
</div>

Thank you.

发布评论

评论列表(0)

  1. 暂无评论