邓洁 : 修改页面细节
This commit is contained in:
@@ -12,7 +12,8 @@ import {defineProps} from "vue";
|
||||
const props = defineProps({
|
||||
dictType: {
|
||||
type: String,
|
||||
default: ""
|
||||
default: "",
|
||||
required:true
|
||||
},
|
||||
value: {
|
||||
type: Object,
|
||||
@@ -26,30 +27,30 @@ const tag = reactive({
|
||||
label: "",
|
||||
theme: ""
|
||||
});
|
||||
const dictList = cacheStore.getDict(props.dictType);
|
||||
const dictList=ref()
|
||||
const getDicList=async ()=>{
|
||||
dictList.value =await cacheStore.getDict(props.dictType);
|
||||
}
|
||||
onMounted(async ()=>{
|
||||
await getDicList()
|
||||
await dictFormat();
|
||||
})
|
||||
const dictFormat = () => {
|
||||
if (dictList === undefined) return;
|
||||
if (dictList.value === undefined) return;
|
||||
let dictValue = ''
|
||||
if (props.value === true || props.value === false) {
|
||||
dictValue = JSON.stringify(props.value)
|
||||
} else {
|
||||
dictValue = props.value
|
||||
}
|
||||
for (let i = 0; i < dictList.length; i++) {
|
||||
if (dictList[i].value == dictValue) {
|
||||
tag.label = dictList[i].label;
|
||||
tag.listClass = dictList[i].listClass;
|
||||
tag.isType = dictList[i].isType;
|
||||
tag.theme = dictList[i].theme;
|
||||
dictList.value.forEach(item=>{
|
||||
if(item.value==dictValue){
|
||||
tag.label = item.label;
|
||||
tag.listClass = item.listClass;
|
||||
tag.isType = item.isType;
|
||||
tag.theme = item.theme;
|
||||
}
|
||||
}
|
||||
// for (let item of dictList) {
|
||||
// if (item.value == props.value) {
|
||||
// tag.label = item.label;
|
||||
// tag.listClass = item.listClass;
|
||||
// tag.isType = item.isType;
|
||||
// }
|
||||
// }
|
||||
})
|
||||
};
|
||||
|
||||
dictFormat();
|
||||
|
||||
Reference in New Issue
Block a user