Skip to content

Conversation

@zsdycs
Copy link
Contributor

@zsdycs zsdycs commented Apr 3, 2024

Description

  1. Fix errors in Vue2.6 demo
  2. Fix the issue of not being able to obtain the latest value of a component when modifying its value for the first time after initializing the assignment and then assigning it to the component again (for example, API returns data and assigns it to the component)

  1. 修复vue2.6 demo的错误
  2. 修复在初始化赋值后,再次赋值给组件后(例如:API返回数据后赋值给组件),第一次修改组件的值时,不能获得组件的最新值的问题

Additional context

例如:

<template>
    <JsonEditorVue  v-model="value" mode="text" @input="onInput" />
</template>
<script>
import JsonEditorVue  ......
export default {
  components: { JsonEditorVue },
  data() { return { data: { value: {}, }, } },
  mounted() {
    this.value = [
      {
        a: 'b',
        c: 'd',
      }
    ]
  },
  methods: {
    onInput(data) {
      // 由于在 mounted() 中对 value 再次修改,
      // 所以会导致 `src > Component.ts > onChange` 中的 `preventUpdatingModelValue.value` 为 true,
      // 导致 `onInput` 获取不到第一次修改的值
      console.log('onInput: ', data)
    }
  }
}
</script>

@cloydlau cloydlau changed the title fix: Reset "preventUpdatingModelValue" timing adjustment and fix demo vue 2.6 chore(demo): fix an error in Vue 2.6 demo—Property or method "value" is not defined on the instance but referenced during render Apr 4, 2024
@cloydlau cloydlau merged commit 4bc819d into cloydlau:main Apr 4, 2024
@cloydlau
Copy link
Owner

cloydlau commented Apr 4, 2024

你好,你说的第二个问题由 [email protected] 升级引起,在 [email protected] 中,对绑定值进行编程式修改不再触发事件,所以 json-editor-vue 直接把两个 flags 去掉即可。[email protected] 已发布,可以试试。

@zsdycs
Copy link
Contributor Author

zsdycs commented Apr 7, 2024

[email protected] 可以的,我测试了,问题解决了。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants