qiuquanwu / vue3-json-viewer

Simple JSON viewer component, for Vue.js 3.x
https://vjv-doc-qiuquanwu.vercel.app/
MIT License
103 stars 15 forks source link

透過下面方式添加項目,會有 bug 無法顯示到畫面上 QQ #26

Open ayii0111 opened 5 hours ago

ayii0111 commented 5 hours ago
<script setup>
const arrRef = ref([11, 22])
const numRef = ref(0)
watch(numRef, () => {
  arrRef.value.push({ [numRef.value]: numRef.value })
  console.log(arrRef.value) // 可以在控制台中看見,arrRef 陣列一直添加,但畫面上卻沒有響應
})
function foo () {
  numRef.value++
}
</script>

<template>
  <div class="box">
    <button @click="foo">
      foo
    </button>

    <h4>Dark</h4>
    <JsonViewer :value="arrRef" copyable boxed sort theme="dark" />
  </div>
</template>

<style></style>