perf(web): 使用map查找推送失败的源

This commit is contained in:
Xwite
2023-05-07 11:40:33 +08:00
parent 7d47970f70
commit 4874558fe8
3 changed files with 27 additions and 26 deletions
+7 -3
View File
@@ -4,7 +4,7 @@
border
:label="sourceUrl"
:class="{
error: errorPushSources.includes(source),
error: isSaveError,
edit: sourceUrl == currentSourceUrl,
}"
>
@@ -17,12 +17,16 @@
import { Edit } from "@element-plus/icons-vue";
const props = defineProps(["source"]);
const sourceUrl = props.source.bookSourceUrl || props.source.sourceUrl;
const store = useSourceStore();
const { errorPushSources, currentSourceUrl } = storeToRefs(store);
const { savedSourcesMap, currentSourceUrl, sourceUrlKey } = storeToRefs(store);
const sourceUrl = computed(() => props.source[sourceUrlKey.value]);
const handleSourceClick = (source) => {
store.changeCurrentSource(source);
};
const isSaveError = computed(() => {
if (savedSourcesMap.value.size == 0) return false;
return !savedSourcesMap.value.has(sourceUrl.value);
});
</script>
<style lang="scss" scoped>
:deep(.el-checkbox__label) {