mirror of
https://github.com/Tencent/tmagic-editor.git
synced 2025-05-06 18:36:44 +08:00
feat(form): text配置支持函数
This commit is contained in:
parent
63d8c98822
commit
26cd37be23
@ -14,7 +14,7 @@
|
|||||||
></m-fields-hidden>
|
></m-fields-hidden>
|
||||||
|
|
||||||
<component
|
<component
|
||||||
v-else-if="items && !config.text && type && display"
|
v-else-if="items && !text && type && display"
|
||||||
:key="key(config)"
|
:key="key(config)"
|
||||||
:size="size"
|
:size="size"
|
||||||
:is="tagName"
|
:is="tagName"
|
||||||
@ -35,12 +35,12 @@
|
|||||||
<template v-else-if="type && display && !showDiff">
|
<template v-else-if="type && display && !showDiff">
|
||||||
<TMagicFormItem
|
<TMagicFormItem
|
||||||
:style="config.tip ? 'flex: 1' : ''"
|
:style="config.tip ? 'flex: 1' : ''"
|
||||||
:class="{ hidden: `${itemLabelWidth}` === '0' || !config.text }"
|
:class="{ hidden: `${itemLabelWidth}` === '0' || !text }"
|
||||||
:prop="itemProp"
|
:prop="itemProp"
|
||||||
:label-width="itemLabelWidth"
|
:label-width="itemLabelWidth"
|
||||||
:rules="rule"
|
:rules="rule"
|
||||||
>
|
>
|
||||||
<template #label><span v-html="type === 'checkbox' ? '' : config.text"></span></template>
|
<template #label><span v-html="type === 'checkbox' ? '' : text"></span></template>
|
||||||
<TMagicTooltip v-if="tooltip">
|
<TMagicTooltip v-if="tooltip">
|
||||||
<component
|
<component
|
||||||
:key="key(config)"
|
:key="key(config)"
|
||||||
@ -91,13 +91,13 @@
|
|||||||
<!-- 上次内容 -->
|
<!-- 上次内容 -->
|
||||||
<TMagicFormItem
|
<TMagicFormItem
|
||||||
:style="config.tip ? 'flex: 1' : ''"
|
:style="config.tip ? 'flex: 1' : ''"
|
||||||
:class="{ hidden: `${itemLabelWidth}` === '0' || !config.text }"
|
:class="{ hidden: `${itemLabelWidth}` === '0' || !text }"
|
||||||
:prop="itemProp"
|
:prop="itemProp"
|
||||||
:label-width="itemLabelWidth"
|
:label-width="itemLabelWidth"
|
||||||
:rules="rule"
|
:rules="rule"
|
||||||
style="background: #f7dadd"
|
style="background: #f7dadd"
|
||||||
>
|
>
|
||||||
<template #label><span v-html="type === 'checkbox' ? '' : config.text"></span></template>
|
<template #label><span v-html="type === 'checkbox' ? '' : text"></span></template>
|
||||||
<TMagicTooltip v-if="tooltip">
|
<TMagicTooltip v-if="tooltip">
|
||||||
<component
|
<component
|
||||||
:key="key(config)"
|
:key="key(config)"
|
||||||
@ -140,13 +140,13 @@
|
|||||||
<!-- 当前内容 -->
|
<!-- 当前内容 -->
|
||||||
<TMagicFormItem
|
<TMagicFormItem
|
||||||
:style="config.tip ? 'flex: 1' : ''"
|
:style="config.tip ? 'flex: 1' : ''"
|
||||||
:class="{ hidden: `${itemLabelWidth}` === '0' || !config.text }"
|
:class="{ hidden: `${itemLabelWidth}` === '0' || !text }"
|
||||||
:prop="itemProp"
|
:prop="itemProp"
|
||||||
:label-width="itemLabelWidth"
|
:label-width="itemLabelWidth"
|
||||||
:rules="rule"
|
:rules="rule"
|
||||||
style="background: #def7da"
|
style="background: #def7da"
|
||||||
>
|
>
|
||||||
<template #label><span v-html="type === 'checkbox' ? '' : config.text"></span></template>
|
<template #label><span v-html="type === 'checkbox' ? '' : text"></span></template>
|
||||||
<TMagicTooltip v-if="tooltip">
|
<TMagicTooltip v-if="tooltip">
|
||||||
<component
|
<component
|
||||||
:key="key(config)"
|
:key="key(config)"
|
||||||
@ -294,6 +294,8 @@ const tagName = computed(() => {
|
|||||||
|
|
||||||
const disabled = computed(() => props.disabled || filterFunction(mForm, props.config.disabled, props));
|
const disabled = computed(() => props.disabled || filterFunction(mForm, props.config.disabled, props));
|
||||||
|
|
||||||
|
const text = computed(() => filterFunction(mForm, props.config.text, props));
|
||||||
|
|
||||||
const tooltip = computed(() => filterFunction(mForm, props.config.tooltip, props));
|
const tooltip = computed(() => filterFunction(mForm, props.config.tooltip, props));
|
||||||
|
|
||||||
const extra = computed(() => filterFunction(mForm, props.config.extra, props));
|
const extra = computed(() => filterFunction(mForm, props.config.extra, props));
|
||||||
@ -331,7 +333,7 @@ watch(
|
|||||||
showDiff,
|
showDiff,
|
||||||
(showDiff) => {
|
(showDiff) => {
|
||||||
if (type.value === 'hidden') return;
|
if (type.value === 'hidden') return;
|
||||||
if (items.value && !props.config.text && type.value && display.value) return;
|
if (items.value && !text.value && type.value && display.value) return;
|
||||||
if (display.value && showDiff && type.value) {
|
if (display.value && showDiff && type.value) {
|
||||||
emit('addDiffCount');
|
emit('addDiffCount');
|
||||||
}
|
}
|
||||||
|
@ -84,7 +84,7 @@ export interface FormItem {
|
|||||||
/** 值发生改变时调用的方法 */
|
/** 值发生改变时调用的方法 */
|
||||||
onChange?: OnChangeHandler;
|
onChange?: OnChangeHandler;
|
||||||
/** label 标签的文本 */
|
/** label 标签的文本 */
|
||||||
text?: string;
|
text?: string | FilterFunction;
|
||||||
/** 右侧感叹号 */
|
/** 右侧感叹号 */
|
||||||
tip?: string;
|
tip?: string;
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user