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