Skip to content

Commit

Permalink
feat: 拖拽模式新增drag-mode参数,支持用户自定义
Browse files Browse the repository at this point in the history
  • Loading branch information
leefinder committed Aug 14, 2023
1 parent fe8b39e commit c8188a5
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 1 deletion.
10 changes: 9 additions & 1 deletion packages/formEditor/components/Selection/selectElement.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -277,7 +277,7 @@ export default {
{...useAttrs()}
class={[
ns.b(),
unref(isEditModel) && props.hasDrag && 'handle',
unref(isEditModel) && ER?.props?.dragMode === 'full' && props.hasDrag && 'handle',
!isField && ns.e('borderless'),
unref(isEditModel) && ns.e('editor'),
unref(isEditModel) && Selected.value,
Expand All @@ -288,6 +288,14 @@ export default {
ref={elementRef} onClick={unref(isEditModel) && withModifiers(handleClick, ['stop'])}
>
{slots.default()}
{
ER?.props?.dragMode === 'icon' &&
unref(isEditModel) && (
<div class={[ns.e('topLeft')]}>
{props.hasDrag && (<Icon class={['handle', ns.e('dragIcon')]} icon="Rank"></Icon>)}
</div>
)
}
{
unref(isEditModel) && (
<div class={[ns.e('bottomRight')]}>
Expand Down
5 changes: 5 additions & 0 deletions packages/formEditor/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,11 @@ const props = defineProps(_.merge({
isShowI18n: {
type: Boolean,
default: true
},
dragMode: {
type: String,
default: 'icon',
validator: (value) => ['full', 'icon'].includes(value)
}
}, defaultProps))
const layout = {
Expand Down

0 comments on commit c8188a5

Please sign in to comment.