mirror of
https://github.com/Tencent/tmagic-editor.git
synced 2025-12-02 15:42:24 +08:00
feat(form): text新增prepend, append不默认使用button
This commit is contained in:
parent
3435661348
commit
cea6569020
@ -11,6 +11,9 @@
|
|||||||
@input="inputHandler"
|
@input="inputHandler"
|
||||||
@keyup="keyUpHandler($event)"
|
@keyup="keyUpHandler($event)"
|
||||||
>
|
>
|
||||||
|
<template #prepend v-if="config.prepend">
|
||||||
|
<span>{{ config.prepend }}</span>
|
||||||
|
</template>
|
||||||
<template #append v-if="appendConfig">
|
<template #append v-if="appendConfig">
|
||||||
<TMagicButton
|
<TMagicButton
|
||||||
v-if="appendConfig.type === 'button'"
|
v-if="appendConfig.type === 'button'"
|
||||||
@ -20,6 +23,7 @@
|
|||||||
>
|
>
|
||||||
{{ appendConfig.text }}
|
{{ appendConfig.text }}
|
||||||
</TMagicButton>
|
</TMagicButton>
|
||||||
|
<span v-else>{{ appendConfig.text }}</span>
|
||||||
</template>
|
</template>
|
||||||
</TMagicInput>
|
</TMagicInput>
|
||||||
|
|
||||||
@ -66,18 +70,26 @@ const mForm = inject<FormState | undefined>('mForm');
|
|||||||
const appendConfig = computed(() => {
|
const appendConfig = computed(() => {
|
||||||
if (typeof props.config.append === 'string') {
|
if (typeof props.config.append === 'string') {
|
||||||
return {
|
return {
|
||||||
|
type: 'text',
|
||||||
text: props.config.append,
|
text: props.config.append,
|
||||||
type: 'button',
|
|
||||||
handler: undefined,
|
handler: undefined,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
if (typeof props.config.append === 'object') {
|
||||||
if (props.config.append && typeof props.config.append === 'object') {
|
if (typeof props.config.append?.handler === 'function') {
|
||||||
if (props.config.append.value === 0) {
|
return {
|
||||||
return false;
|
type: 'button',
|
||||||
|
text: props.config.append.text,
|
||||||
|
handler: props.config.append.handler,
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
if (props.config.append) {
|
||||||
|
if (props.config.append.value === 0) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
return props.config.append;
|
return props.config.append;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user