refactor(modules/web): arrange storeToRefs destruct

This commit is contained in:
Xwite
2024-10-02 21:38:40 +08:00
parent eb8231e705
commit 2aa81f14e3
10 changed files with 56 additions and 44 deletions
+5 -2
View File
@@ -18,14 +18,17 @@ import { Edit } from "@element-plus/icons-vue";
import { getSourceUniqueKey } from "@/utils/souce";
const props = defineProps(["source"]);
const store = useSourceStore();
const { savedSourcesMap, currentSourceUrl } = storeToRefs(store);
const currentSourceUrl = computed(() => store.currentSourceUrl);
const sourceUrl = computed(() => getSourceUniqueKey(props.source));
const handleSourceClick = (source) => {
store.changeCurrentSource(source);
};
const isSaveError = computed(() => {
const map = savedSourcesMap.value;
const map = store.savedSourcesMap;
if (map.size == 0) return false;
return !map.has(sourceUrl.value);
});