mirror of
https://github.com/Tencent/tmagic-editor.git
synced 2025-09-21 06:19:59 +08:00
feat(form): 展开更多支持配置函数
This commit is contained in:
parent
0ca0abf2da
commit
9fd8385651
@ -97,7 +97,9 @@
|
||||
</template>
|
||||
|
||||
<div style="text-align: center" v-if="config.expand && type !== 'fieldset'">
|
||||
<TMagicButton text @click="expandHandler">{{ expand ? '收起配置' : '展开更多配置' }}</TMagicButton>
|
||||
<TMagicButton type="primary" size="small" text @click="expandHandler">{{
|
||||
expand ? '收起配置' : '展开更多配置'
|
||||
}}</TMagicButton>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
@ -177,11 +179,12 @@ const type = computed((): string => {
|
||||
});
|
||||
|
||||
const display = computed((): boolean => {
|
||||
if (props.config.display === 'expand') {
|
||||
const value = displayFunction(mForm, props.config.display, props);
|
||||
|
||||
if (value === 'expand') {
|
||||
return expand.value;
|
||||
}
|
||||
|
||||
return displayFunction(mForm, props.config.display, props);
|
||||
return value;
|
||||
});
|
||||
|
||||
const itemLabelWidth = computed(() => props.config.labelWidth || props.labelWidth);
|
||||
|
@ -197,6 +197,10 @@ export const filterFunction = (mForm: FormState | undefined, config: any, props:
|
||||
};
|
||||
|
||||
export const display = function (mForm: FormState | undefined, config: any, props: any) {
|
||||
if (config === 'expand') {
|
||||
return config;
|
||||
}
|
||||
|
||||
if (typeof config === 'function') {
|
||||
return filterFunction(mForm, config, props);
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user