backend/docs/调用字典.md
2026-01-26 09:32:17 +08:00

27 lines
654 B
Markdown

````
<template>
{{ (xxxxxxxxDict.find(item => item.dict_value == String(model?.status)) || {}).dict_label || '-' }}
</template>
<script lang="ts" setup>
import { onMounted } from 'vue';
import { useDictStore } from '@/stores/dict';
// 字典store
const dictStore = useDictStore();
const xxxxxxxxDict = ref<any[]>([]);
// 获取审核状态字典
const fetchxxxxxxxxDict = async () => {
try {
xxxxxxxxDict.value = await dictStore.getDictItems('article_status');
console.log(xxxxxxxxDict.value);
} catch (err) {
console.error('获取文章状态字典失败:', err);
}
};
onMounted(() => {
fetchxxxxxxxxDict();
});
</script>
````