refactor: 修改缓存加载逻辑.

This commit is contained in:
lijiahang
2023-12-04 16:08:14 +08:00
parent f4b5ba168a
commit 4cfc22753b
16 changed files with 119 additions and 76 deletions

View File

@@ -51,18 +51,6 @@
});
const optionData = ref<SelectOptionData[]>([]);
// 初始化选项
onBeforeMount(() => {
cacheStore.loadTags(props.type as string).then((tags) => {
optionData.value = tags.map(s => {
return {
label: s.name,
value: s.id,
};
});
});
});
// 检查是否可以创建tag
const checkCreateTag = async (tags: Array<any>) => {
if (!tags.length) {
@@ -112,6 +100,23 @@
return id;
};
// 初始化选项
onBeforeMount(async () => {
setLoading(true);
try {
const tags = await cacheStore.loadTags(props.type as string);
optionData.value = tags.map(s => {
return {
label: s.name,
value: s.id,
};
});
} catch (e) {
} finally {
setLoading(false);
}
});
</script>
<style lang="less" scoped>