From 35f33e7f22c7a7b648e9ddf8fe0e98d8bd03dd95 Mon Sep 17 00:00:00 2001 From: Huangzhe Date: Sun, 23 Mar 2025 16:46:25 +0800 Subject: [PATCH] =?UTF-8?q?feat[create]:=20=E5=AE=8C=E6=88=90=E5=8D=95?= =?UTF-8?q?=E9=80=89=E7=BD=AE=E5=BA=95=E5=A4=9A=E9=80=89=E6=8E=92=E5=AE=83?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - choice 新增 handleChange 函数,处理多选排它项 - option-action 新增 isPreview 传参,处理 置底和排它的顺序功能 --- .../ActionCompoents/OptionAction.vue | 26 ++++++++++++++-- src/views/Design/components/Draggable.vue | 30 ++++++++++++++++--- .../Design/components/Questions/Choice.vue | 27 ++++++++++++++++- 3 files changed, 75 insertions(+), 8 deletions(-) diff --git a/src/views/Design/components/ActionCompoents/OptionAction.vue b/src/views/Design/components/ActionCompoents/OptionAction.vue index 4499603..71bc5cb 100644 --- a/src/views/Design/components/ActionCompoents/OptionAction.vue +++ b/src/views/Design/components/ActionCompoents/OptionAction.vue @@ -1,8 +1,9 @@ @@ -84,6 +86,10 @@ import CheckboxAction from './components/OptionItemAction/CheckboxAction.vue'; import { ref } from 'vue'; import { showConfirmDialog } from 'vant'; import Draggable from '@/views/Design/components/Draggable.vue'; + +// 是否是预览模式 +const isPreview = defineModel('isPreview', { default: false, type: Boolean }); + defineProps({ active: { type: Boolean, @@ -100,11 +106,11 @@ defineProps({ default: '' } }); - const element = defineModel('data', { type: Array, default: () => [] }); + const actions = [ { name: '上移选项', action: 'up' }, { name: '下移选项', action: 'down' } @@ -119,6 +125,21 @@ const updateData = (newValue) => { element.value = newValue; }; +/** + * 将当前激活的选项置底 + */ +function handleLastOption(value) { + // 检查是否有有效的选项被激活 + if (value === 0) return; + if (!activeIndex.value >= 0) return; + + // 寻找当前激活的选项 + const activeOption = element.value[activeIndex.value]; + activeOption.is_fixed = value; + // // 触发数据更新 + // updateData([...element.value]); +} + // emit('update:data'); /** * @name 打开model弹窗 @@ -159,7 +180,6 @@ const optionMove = (action) => { }; // 删除当前选项 - const deleteOption = (index) => { showConfirmDialog({ title: '提示', diff --git a/src/views/Design/components/Draggable.vue b/src/views/Design/components/Draggable.vue index 2c72a6f..9828c99 100644 --- a/src/views/Design/components/Draggable.vue +++ b/src/views/Design/components/Draggable.vue @@ -1,7 +1,7 @@