diff --git a/components.d.ts b/components.d.ts index cc91605..7b27095 100644 --- a/components.d.ts +++ b/components.d.ts @@ -8,14 +8,9 @@ export {} declare module 'vue' { export interface GlobalComponents { Contenteditable: typeof import('./src/components/contenteditable.vue')['default'] - ElButton: typeof import('element-plus/es')['ElButton'] - ElDropdown: typeof import('element-plus/es')['ElDropdown'] - ElDropdownItem: typeof import('element-plus/es')['ElDropdownItem'] - ElDropdownMenu: typeof import('element-plus/es')['ElDropdownMenu'] ElInput: typeof import('element-plus/es')['ElInput'] ElOption: typeof import('element-plus/es')['ElOption'] ElSelect: typeof import('element-plus/es')['ElSelect'] - ElSpace: typeof import('element-plus/es')['ElSpace'] ElTable: typeof import('element-plus/es')['ElTable'] ElTableColumn: typeof import('element-plus/es')['ElTableColumn'] ElText: typeof import('element-plus/es')['ElText'] @@ -34,7 +29,6 @@ declare module 'vue' { VanGrid: typeof import('vant/es')['Grid'] VanGridItem: typeof import('vant/es')['GridItem'] VanIcon: typeof import('vant/es')['Icon'] - VanList: typeof import('vant/es')['List'] VanNavBar: typeof import('vant/es')['NavBar'] VanPicker: typeof import('vant/es')['Picker'] VanPopover: typeof import('vant/es')['Popover'] @@ -42,7 +36,6 @@ declare module 'vue' { VanRadio: typeof import('vant/es')['Radio'] VanRadioGroup: typeof import('vant/es')['RadioGroup'] VanRow: typeof import('vant/es')['Row'] - VanSearch: typeof import('vant/es')['Search'] VanStepper: typeof import('vant/es')['Stepper'] VanSwitch: typeof import('vant/es')['Switch'] VanTab: typeof import('vant/es')['Tab'] diff --git a/src/views/Design/components/ChooseQuestion.vue b/src/views/Design/components/ChooseQuestion.vue index b554564..564b46a 100644 --- a/src/views/Design/components/ChooseQuestion.vue +++ b/src/views/Design/components/ChooseQuestion.vue @@ -69,9 +69,7 @@ const element = defineModel('element', { return {}; } }); -const index = defineModel('index', { - type: Number -}); +const index = defineModel('index'); // watch( // () => index.value, diff --git a/src/views/Design/components/Questions/Choice.vue b/src/views/Design/components/Questions/Choice.vue index 4863cc0..c129ecb 100644 --- a/src/views/Design/components/Questions/Choice.vue +++ b/src/views/Design/components/Questions/Choice.vue @@ -130,8 +130,7 @@ defineProps({ default: false }, index: { - type: Number, - default: 0 + default: '' } }); @@ -157,6 +156,8 @@ function handleChange(names) { const newOption = names[names.length - 1]; // 如果names 长度小于1,直接返回,不处理 if (names.length < 1) return; + // 如果不存在 options 和 list 属性,直接返回 + if (!element.value.options || !element.value.list) return; const options = element.value.options[0] ?? element.value.list[0]; // 如果新增的结果是排它项, 对结果进行处理 diff --git a/src/views/Design/components/Questions/Completion.vue b/src/views/Design/components/Questions/Completion.vue index 6f50df2..c20eabc 100644 --- a/src/views/Design/components/Questions/Completion.vue +++ b/src/views/Design/components/Questions/Completion.vue @@ -45,7 +45,6 @@ const props = defineProps({ } }, index: { - type: Number, default: 0 }, active: { diff --git a/src/views/Design/components/Questions/FileUpload.vue b/src/views/Design/components/Questions/FileUpload.vue index 8c1ca62..3e51bd6 100644 --- a/src/views/Design/components/Questions/FileUpload.vue +++ b/src/views/Design/components/Questions/FileUpload.vue @@ -7,7 +7,7 @@ import { fileLimit, answer } from './hooks/useFileUploadHooks'; const isPreview = defineModel('isPreview', { default: false, type: Boolean, required: false }); const props = defineProps<{ element: any; - index: number; + index: number | String; active: boolean; }>(); const { element } = toRefs(props); diff --git a/src/views/Design/components/Questions/MatrixCheckbox.vue b/src/views/Design/components/Questions/MatrixCheckbox.vue index 1c48316..402066e 100644 --- a/src/views/Design/components/Questions/MatrixCheckbox.vue +++ b/src/views/Design/components/Questions/MatrixCheckbox.vue @@ -36,7 +36,7 @@ const isOptionChecked = (rowIndex: number, colIndex: number): boolean => { }; // 当 matrix radio 选中时,更新 rowRecord 和 matrixAnswer -function handleMatrixCheckboxChange(row: number, col: number) { +function handleMatrixCheckboxChange (row: number, col: number) { // 获取 colIndexArray if (!rowRecord.value[row]) { // 如果没有对应的row,创建一个 diff --git a/src/views/Design/components/Questions/MatrixQuestion.vue b/src/views/Design/components/Questions/MatrixQuestion.vue index 434dac0..435b1c0 100644 --- a/src/views/Design/components/Questions/MatrixQuestion.vue +++ b/src/views/Design/components/Questions/MatrixQuestion.vue @@ -28,7 +28,7 @@ const rows = defineModel<_questionOptionType[]>('rows', { required: false, defau // 列标签 const cols = defineModel<_questionOptionType[]>('cols', { required: false, default: () => [] }); // 题的序号 -const index = defineModel('index', { required: false, default: 0 }); +const index = defineModel('index', { required: false, default: 0 }); // 是否是编辑状态 const active = defineModel('active', { required: false, default: false }); diff --git a/src/views/Design/components/Questions/NPS.vue b/src/views/Design/components/Questions/NPS.vue index 1d99d83..874cb92 100644 --- a/src/views/Design/components/Questions/NPS.vue +++ b/src/views/Design/components/Questions/NPS.vue @@ -58,8 +58,7 @@ const isPreview = defineModel('isPreview', { default: false, type: Boolean }); default: false }, index: { - type: Number, - default: 0 + default: '' }, active: { type: Boolean, diff --git a/src/views/Design/components/Questions/Rate.vue b/src/views/Design/components/Questions/Rate.vue index 6a8499f..e002156 100644 --- a/src/views/Design/components/Questions/Rate.vue +++ b/src/views/Design/components/Questions/Rate.vue @@ -1,42 +1,22 @@