feat: preview 组件适配
- 适配多选题组件
This commit is contained in:
@@ -19,7 +19,7 @@
|
||||
</contenteditable>
|
||||
</template>
|
||||
<template #input>
|
||||
<template v-for="(item, optionIndex) in element.options" :key="item.id">
|
||||
<template v-for="item /*optionIndex*/ in element.options" :key="item.id">
|
||||
<van-radio-group v-if="element.question_type === 1" v-model="choiceValue">
|
||||
<option-action
|
||||
:data="isPreview ? item.options : item"
|
||||
@@ -61,7 +61,7 @@
|
||||
|
||||
<van-checkbox-group v-if="element.question_type === 2" v-model="value" shape="square">
|
||||
<option-action
|
||||
v-model:data="element.options[optionIndex]"
|
||||
:data="isPreview ? item.options : item"
|
||||
handle=".moverQues"
|
||||
:active="active"
|
||||
:question="element"
|
||||
@@ -102,13 +102,12 @@
|
||||
</template>
|
||||
<script setup>
|
||||
import OptionAction from '@/views/Design/components/ActionCompoents/OptionAction.vue';
|
||||
import { defineAsyncComponent, ref } from 'vue';
|
||||
import { defineAsyncComponent } from 'vue';
|
||||
|
||||
// 是否是预览
|
||||
const isPreview = defineModel('isPreview', { default: false, type: Boolean });
|
||||
const choiceValue = defineModel('answer', { default: '1', type: String });
|
||||
|
||||
// console.log(`choiceValue.value`, choiceValue.value);
|
||||
const value = defineModel('checkboxAnswer', { default: [1, 2], type: Array });
|
||||
|
||||
const Contenteditable = defineAsyncComponent(() => import('@/components/contenteditable.vue'));
|
||||
defineProps({
|
||||
@@ -121,6 +120,11 @@ defineProps({
|
||||
default: 0
|
||||
}
|
||||
});
|
||||
|
||||
/**
|
||||
* 题目
|
||||
* @type {ModelRef<Object, string, Object, Object>}
|
||||
*/
|
||||
const element = defineModel('element', {
|
||||
type: Object,
|
||||
default: () => {
|
||||
@@ -129,7 +133,6 @@ const element = defineModel('element', {
|
||||
};
|
||||
}
|
||||
});
|
||||
const value = ref([]);
|
||||
const emit = defineEmits(['update:element']);
|
||||
const emitValue = () => {
|
||||
emit('update:element', element.value);
|
||||
|
||||
Reference in New Issue
Block a user