Skip to content

[AList] stops working if items(ref list) is updated #141

@lospringliu

Description

@lospringliu

https://stackblitz.com/edit/vitejs-vite-l8eezu?file=src/App.vue

<script setup>
import { ref } from "vue"
import HelloWorld from './components/HelloWorld.vue'
const items = ref([
  {id: 1, text: "item 1"},
  {id: 2, text: "item 2"},
  {id: 3, text: "item 3"},
])

const addItem = () => {
  console.log('clicked')
  const id = Math.floor(Math.random() * 100)
  items.value.push({id: 4, text: "added item 4" })
}
const selected = ref(null)
</script>

<template>
  <ABtn @click="addItem"> test anu list with ref and dynamically update </ABtn>

  <AList v-model="selected" :items="items">
  </AList>

  selected: {{ selected }}
</template>

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions