如何在 Vue 3 中使用 Vue.util.extend?

Nee*_*101 5 javascript vue.js vuejs3

如何在 Vue 组件中使用 Vue.util.extend?

我需要从 prop 复制数据(没有引用),建议使用Vue.util.extend({}, this.propData),但没有关于如何使用它的说明。

我到底需要导入什么才能使辅助函数正常工作?

示例组件.vue

<script>
import Vue ...???

export default {

  props: {
    propData: Array
  }

  data() {
    return() {
      localPropData: Vue.util.extend({}, this.propData)
    }
  }
}
</script>
Run Code Online (Sandbox Code Playgroud)

即使是某种形式的文档链接也会有所帮助。现在我决定只使用 JSON.parse(JSON.stringify(this.propData)) ,它工作得很好。

通过 Laravel 8 使用 Vue 3