|
本帖最后由 vform 于 2023-3-21 14:26 编辑
给不需要拖动的组件加一个class。
在draggable上添加filter
修改拖动的逻辑,不在拖动的时候生成ID- <draggable tag="ul" :list="basicFields" :group="{name: 'dragGroup', pull: 'clone', put: false}"
- :move="checkFieldMove"
- filter=".added"
- :clone="handleFieldWidgetClone" ghost-class="ghost" :sort="false">
- <li v-for="(fld, index) in basicFields" :key="index"
- class="field-widget-item"
- :class="{added: widgetRefList.includes(fld.options.name)}"
- :title="fld.displayName"
- @dblclick="addFieldByDbClick(fld)">
- <span><svg-icon :icon-class="fld.icon" class-name="color-svg-icon"/>{{ fld.displayName }}</span>
- </li>
- </draggable>
复制代码
data
watch
- 'designer.widgetList': {
- deep: true,
- handler(val) {
- this.$nextTick(() => {
- this.widgetRefList = Object.keys(this.designer.formWidget.widgetRefList)
- })
- }
- }
复制代码 mount
- this.$nextTick(() => {
- this.widgetRefList = Object.keys(this.designer.formWidget.widgetRefList)
- })
复制代码
|
|