feat: 新增题目操作功能
- 添加 OptionAction 和 QuestionAction 组件 - 在 BaseSelect 组件中集成新功能 - 更新 ChooseQuestion 组件,添加单选题添加选项功能 -调整样式,增加空间间隔和对齐方式
This commit is contained in:
@@ -4,9 +4,15 @@
|
||||
:label="element.stem"
|
||||
:required="element.config.is_required === 1"
|
||||
label-align="top"
|
||||
class="base-select"
|
||||
>
|
||||
<template #label>
|
||||
<div v-html="element.stem"></div>
|
||||
<div
|
||||
:contenteditable="active"
|
||||
class="van-field"
|
||||
@blur="saveStem($event, element)"
|
||||
v-html="element.stem"
|
||||
></div>
|
||||
</template>
|
||||
<template #input>
|
||||
<van-checkbox-group>
|
||||
@@ -17,10 +23,20 @@
|
||||
:name="it.value"
|
||||
:label="it.label"
|
||||
:disabled="it.disabled"
|
||||
icon-size="0.35rem"
|
||||
icon-size="0.45rem"
|
||||
>
|
||||
<template #default>
|
||||
<div class="van-cell" :contenteditable="active" v-html="it.option"></div>
|
||||
<div class="flex align-center space-between">
|
||||
<div
|
||||
class="van-cell van-cell--borderless"
|
||||
:contenteditable="active"
|
||||
@blur="saveOption($event, it)"
|
||||
v-html="it.option"
|
||||
></div>
|
||||
<div class="right-action">
|
||||
<option-action v-if="active"></option-action>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
</van-checkbox>
|
||||
</template>
|
||||
@@ -29,6 +45,7 @@
|
||||
</van-field>
|
||||
</template>
|
||||
<script setup>
|
||||
import OptionAction from '@/views/Design/components/ActionCompoents/OptionAction.vue';
|
||||
import { ref } from 'vue';
|
||||
const props = defineProps({
|
||||
element: {
|
||||
@@ -46,5 +63,25 @@ const props = defineProps({
|
||||
});
|
||||
|
||||
const element = ref(props.element);
|
||||
const saveOption = (e, ele) => {
|
||||
ele.option = e.target.innerHTML;
|
||||
};
|
||||
const saveStem = (e, ele) => {
|
||||
ele.stem = e.target.innerHTML;
|
||||
};
|
||||
</script>
|
||||
<style scoped lang="scss"></style>
|
||||
<style scoped lang="scss">
|
||||
.base-select {
|
||||
& .van-checkbox-group {
|
||||
width: 100%;
|
||||
|
||||
& .van-checkbox {
|
||||
width: 100%;
|
||||
|
||||
& ::v-deep .van-checkbox__label {
|
||||
width: 100%;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
</style>
|
||||
|
||||
Reference in New Issue
Block a user