【发布时间】:2021-05-28 22:43:50
【问题描述】:
我正在使用带有 <script setup> 的 Vue 3,但在尝试使用组件时出现错误。
在 Vue 2 中,它是这样工作的:
<template>
<Tree />
</template>
<script>
import { Tree, Fold, Draggable } from 'he-tree-vue'
export default {
components: {
Tree: Tree.mixPlugins([ Fold, Draggable ])
},
}
</script>
我想使用 Vue 3 和 <script setup> 执行此操作,但出现此错误:
Uncaught TypeError: Cannot set property Tree of # which has only a getter
<template>
<Tree />
</template>
<script setup>
import { Tree, Fold, Draggable } from 'he-tree-vue'
Tree = Tree.mixPlugins([ Fold, Draggable ]) // This is causing an error
</script>
【问题讨论】:
标签: javascript vue.js vue-component