vuedraggable 插件针对vue3.0 升级

604 阅读1分钟

1、 vue3.0 移除了this.$scopedSlots属性

  • const slots = this.$slots.default变更为const slots = this.$slots.default()
  • 替换this.$scopedSlots属性 因为getSlot函数接收的slotscopedSlot意义一致
	// 变更前
    computeChildrenAndOffsets(
      slots,
      this.$slots,
      this.$scopedSlots
    )
	// 变更后
    computeChildrenAndOffsets(
      slots,
      this.$slots,
      this.$slots
    )`

2、 vue3.0 render(h)中的h变更为全局导入,而不是作为参数传递给渲染函数

  • 引入h函数
import { h } from 'vue'
  • 去除render函数默认参数
render(h)变更为render()