feat(components): 为 contenteditable组件添加错误消息显示
- 在 contenteditable.vue 中添加了 errorMessage属性和对应的样式 - 在多个组件中为 contenteditable 添加了 errorMessage 属性 - 优化了部分代码格式,如空格、换行等
This commit is contained in:
@@ -16,12 +16,12 @@ const isPreview = defineModel<boolean>('isPreview', { required: false, default:
|
||||
// eslint-disable-next-line
|
||||
const activeComponent = computed<Component>(() => {
|
||||
switch (question.value.question_type) {
|
||||
case 8:
|
||||
return MatrixText;
|
||||
case 9:
|
||||
return MatrixRadio;
|
||||
case 10:
|
||||
return MatrixCheckbox;
|
||||
case 8:
|
||||
return MatrixText;
|
||||
case 9:
|
||||
return MatrixRadio;
|
||||
case 10:
|
||||
return MatrixCheckbox;
|
||||
}
|
||||
});
|
||||
|
||||
@@ -49,6 +49,10 @@ const emitValue = () => {
|
||||
// console.log(question.value);
|
||||
emit('update:element', question.value);
|
||||
};
|
||||
const errorMessage = defineModel('errorMessage', {
|
||||
type: String,
|
||||
default: ''
|
||||
});
|
||||
</script>
|
||||
|
||||
<template>
|
||||
@@ -64,7 +68,12 @@ const emitValue = () => {
|
||||
</template>
|
||||
<!-- 使用 title 插槽来自定义标题 -->
|
||||
<template #label>
|
||||
<contenteditable v-model="question.stem" :active="active" @blur="emitValue" />
|
||||
<contenteditable
|
||||
v-model="question.stem"
|
||||
:active="active"
|
||||
@blur="emitValue"
|
||||
:errorMessage="errorMessage"
|
||||
/>
|
||||
</template>
|
||||
|
||||
<template #input>
|
||||
|
||||
Reference in New Issue
Block a user