up.
This commit is contained in:
parent
39af3f089a
commit
674ba45152
@ -90,3 +90,4 @@ export function strToBind(type: string, bindStr: string): any {
|
|||||||
}
|
}
|
||||||
return {};
|
return {};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -23,7 +23,7 @@
|
|||||||
<el-switch
|
<el-switch
|
||||||
size="small"
|
size="small"
|
||||||
:model-value="dataValue"
|
:model-value="dataValue"
|
||||||
@update:modelValue="(val) => updatedataValue(val)"
|
@update:modelValue="(val) => updateDataValue(val)"
|
||||||
v-bind="itemBind"
|
v-bind="itemBind"
|
||||||
/>
|
/>
|
||||||
</template>
|
</template>
|
||||||
@ -32,12 +32,12 @@
|
|||||||
</template>
|
</template>
|
||||||
<template v-else-if="props.type === 'checkbox'">
|
<template v-else-if="props.type === 'checkbox'">
|
||||||
<el-checkbox-group v-model="dataValue" v-bind="itemBind">
|
<el-checkbox-group v-model="dataValue" v-bind="itemBind">
|
||||||
<el-checkbox v-for="item in (dataOptions || [])" :label="item.label" :value="item.value" />
|
<el-checkbox v-for="item in option" :label="item.label" :value="item.value" />
|
||||||
</el-checkbox-group>
|
</el-checkbox-group>
|
||||||
</template>
|
</template>
|
||||||
<template v-else-if="props.type === 'radio'">
|
<template v-else-if="props.type === 'radio'">
|
||||||
<el-radio-group v-model="dataValue" v-bind="itemBind">
|
<el-radio-group v-model="dataValue" v-bind="itemBind">
|
||||||
<el-radio v-for="item in (dataOptions || [])" :label="item.label" :value="item.value" />
|
<el-radio v-for="item in option" :label="item.label" :value="item.value" />
|
||||||
</el-radio-group>
|
</el-radio-group>
|
||||||
</template>
|
</template>
|
||||||
<template v-else-if="props.type === 'date'">
|
<template v-else-if="props.type === 'date'">
|
||||||
@ -82,19 +82,16 @@ const props = defineProps<{
|
|||||||
title: string;
|
title: string;
|
||||||
type: string;
|
type: string;
|
||||||
value: string;
|
value: string;
|
||||||
options: any;
|
option: any;
|
||||||
itemBind: any
|
itemBind: any
|
||||||
}>();
|
}>();
|
||||||
|
|
||||||
const dataValue = ref<any>();
|
const dataValue = ref<any>();
|
||||||
const dataOptions = ref<any>()
|
|
||||||
onMounted(() => {
|
onMounted(() => {
|
||||||
dataOptions.value = props.options;
|
|
||||||
dataValue.value = strToValue(props.type, props.value);
|
dataValue.value = strToValue(props.type, props.value);
|
||||||
// dataOptions.value = strToOption(props.type, props.options);
|
// console.log("渲染完成", props, dataValue.value,);
|
||||||
// console.log("渲染完成", props, dataValue.value, dataOptions.value);
|
|
||||||
});
|
});
|
||||||
const updatedataValue = (val) => {
|
const updateDataValue = (val) => {
|
||||||
console.log("更新val", val);
|
console.log("更新val", val);
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|||||||
@ -23,12 +23,12 @@
|
|||||||
type="card"
|
type="card"
|
||||||
:model-value="defaultTabs(config)"
|
:model-value="defaultTabs(config)"
|
||||||
>
|
>
|
||||||
<el-tab-pane v-for="(name,label) in config.options" :label="label" :name="name">{{label}}</el-tab-pane>
|
<el-tab-pane v-for="(label, name) in config.option" :label="label" :name="name">{{label}}</el-tab-pane>
|
||||||
</el-tabs>
|
</el-tabs>
|
||||||
</template>
|
</template>
|
||||||
<template v-else>
|
<template v-else>
|
||||||
<config-form-item :name="config.name" :title="config.title" :type="config.type" :value="config.value"
|
<config-form-item :name="config.name" :title="config.title" :type="config.type" :value="config.value"
|
||||||
:options="config.options" :item-bind="config.bind"/>
|
:option="config.option" :item-bind="config.bind"/>
|
||||||
<el-form-item v-if="config.tips">
|
<el-form-item v-if="config.tips">
|
||||||
<ele-text type="placeholder" style="line-height: 1.6">
|
<ele-text type="placeholder" style="line-height: 1.6">
|
||||||
{{ config.tips }}
|
{{ config.tips }}
|
||||||
@ -44,7 +44,7 @@ const props = defineProps<{
|
|||||||
configList: any;
|
configList: any;
|
||||||
}>();
|
}>();
|
||||||
const defaultTabs = (cfg: any)=>{
|
const defaultTabs = (cfg: any)=>{
|
||||||
let keys = Object.keys(cfg.options)
|
let keys = Object.keys(cfg.option)
|
||||||
if(keys.length > 0) {
|
if(keys.length > 0) {
|
||||||
return keys[0];
|
return keys[0];
|
||||||
}
|
}
|
||||||
|
|||||||
@ -61,8 +61,8 @@ const reload = () => {
|
|||||||
|
|
||||||
configList.value = configs.map(d=>{
|
configList.value = configs.map(d=>{
|
||||||
// 解析vBind属性到item
|
// 解析vBind属性到item
|
||||||
d.bind = strToBind(d.type, d.vBind);
|
d.bind = strToBind(d.type, d.itemBind);
|
||||||
d.options = strToOption(d.type, d.options);
|
d.option = strToOption(d.type, d.option);
|
||||||
|
|
||||||
if(d.type =='card' || d.type == 'collapse'){
|
if(d.type =='card' || d.type == 'collapse'){
|
||||||
d.children = [
|
d.children = [
|
||||||
@ -119,8 +119,8 @@ const reload = () => {
|
|||||||
}
|
}
|
||||||
];
|
];
|
||||||
for(let a in d.children){
|
for(let a in d.children){
|
||||||
d.children[a].bind = strToBind(d.children[a].type, d.children[a].vBind);
|
d.children[a].bind = strToBind(d.children[a].type, d.children[a].itemBind);
|
||||||
d.children[a].options = strToOption(d.children[a].type, d.children[a].options);
|
d.children[a].option = strToOption(d.children[a].type, d.children[a].option);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return d;
|
return d;
|
||||||
|
|||||||
@ -75,7 +75,7 @@
|
|||||||
<el-input
|
<el-input
|
||||||
:rows="4"
|
:rows="4"
|
||||||
type="textarea"
|
type="textarea"
|
||||||
v-model="form.options"
|
v-model="form.option"
|
||||||
placeholder="请输入配置项"
|
placeholder="请输入配置项"
|
||||||
/>
|
/>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
@ -153,7 +153,7 @@
|
|||||||
name: '',
|
name: '',
|
||||||
type: '',
|
type: '',
|
||||||
tips: '',
|
tips: '',
|
||||||
options: '',
|
option: '',
|
||||||
value: '',
|
value: '',
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user