This commit is contained in:
u2nyakim 2025-08-25 17:43:39 +08:00
parent 39af3f089a
commit 674ba45152
5 changed files with 16 additions and 18 deletions

View File

@ -90,3 +90,4 @@ export function strToBind(type: string, bindStr: string): any {
}
return {};
}

View File

@ -23,7 +23,7 @@
<el-switch
size="small"
:model-value="dataValue"
@update:modelValue="(val) => updatedataValue(val)"
@update:modelValue="(val) => updateDataValue(val)"
v-bind="itemBind"
/>
</template>
@ -32,12 +32,12 @@
</template>
<template v-else-if="props.type === 'checkbox'">
<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>
</template>
<template v-else-if="props.type === 'radio'">
<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>
</template>
<template v-else-if="props.type === 'date'">
@ -82,19 +82,16 @@ const props = defineProps<{
title: string;
type: string;
value: string;
options: any;
option: any;
itemBind: any
}>();
const dataValue = ref<any>();
const dataOptions = ref<any>()
onMounted(() => {
dataOptions.value = props.options;
dataValue.value = strToValue(props.type, props.value);
// dataOptions.value = strToOption(props.type, props.options);
// console.log("", props, dataValue.value, dataOptions.value);
// console.log("", props, dataValue.value,);
});
const updatedataValue = (val) => {
const updateDataValue = (val) => {
console.log("更新val", val);
}
</script>

View File

@ -23,12 +23,12 @@
type="card"
: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>
</template>
<template v-else>
<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">
<ele-text type="placeholder" style="line-height: 1.6">
{{ config.tips }}
@ -44,7 +44,7 @@ const props = defineProps<{
configList: any;
}>();
const defaultTabs = (cfg: any)=>{
let keys = Object.keys(cfg.options)
let keys = Object.keys(cfg.option)
if(keys.length > 0) {
return keys[0];
}

View File

@ -61,8 +61,8 @@ const reload = () => {
configList.value = configs.map(d=>{
// vBinditem
d.bind = strToBind(d.type, d.vBind);
d.options = strToOption(d.type, d.options);
d.bind = strToBind(d.type, d.itemBind);
d.option = strToOption(d.type, d.option);
if(d.type =='card' || d.type == 'collapse'){
d.children = [
@ -119,8 +119,8 @@ const reload = () => {
}
];
for(let a in d.children){
d.children[a].bind = strToBind(d.children[a].type, d.children[a].vBind);
d.children[a].options = strToOption(d.children[a].type, d.children[a].options);
d.children[a].bind = strToBind(d.children[a].type, d.children[a].itemBind);
d.children[a].option = strToOption(d.children[a].type, d.children[a].option);
}
}
return d;

View File

@ -75,7 +75,7 @@
<el-input
:rows="4"
type="textarea"
v-model="form.options"
v-model="form.option"
placeholder="请输入配置项"
/>
</el-form-item>
@ -153,7 +153,7 @@
name: '',
type: '',
tips: '',
options: '',
option: '',
value: '',
});