diff --git a/components.d.ts b/components.d.ts index d704482..2a0a546 100644 --- a/components.d.ts +++ b/components.d.ts @@ -7,6 +7,7 @@ export {} declare module 'vue' { export interface GlobalComponents { + ElBacktop: typeof import('element-plus/es')['ElBacktop'] ElDialog: typeof import('element-plus/es')['ElDialog'] ElDropdown: typeof import('element-plus/es')['ElDropdown'] ElDropdownItem: typeof import('element-plus/es')['ElDropdownItem'] @@ -19,6 +20,8 @@ declare module 'vue' { ElPopover: typeof import('element-plus/es')['ElPopover'] ElScrollbar: typeof import('element-plus/es')['ElScrollbar'] ElSelect: typeof import('element-plus/es')['ElSelect'] + ElSkeleton: typeof import('element-plus/es')['ElSkeleton'] + ElSkeletonItem: typeof import('element-plus/es')['ElSkeletonItem'] ElSwitch: typeof import('element-plus/es')['ElSwitch'] ElTabPane: typeof import('element-plus/es')['ElTabPane'] ElTabs: typeof import('element-plus/es')['ElTabs'] diff --git a/entrypoints/sidepanel/Sidepanel.vue b/entrypoints/sidepanel/Sidepanel.vue index e52adf5..093a616 100644 --- a/entrypoints/sidepanel/Sidepanel.vue +++ b/entrypoints/sidepanel/Sidepanel.vue @@ -17,6 +17,7 @@ import save2TiddlyWiki from '@/utils/save2TiddlyWiki'; import { html2md, md2html } from '@/utils/parser'; import { ElButton, ElMessage as notify } from 'element-plus'; import { checkStatus } from '@/utils/checkStatus'; +import { isDev } from '@/utils/utils'; import { isCheckTw5Storage, tagStorage, @@ -26,6 +27,7 @@ import { } from '@/utils/storage'; // import getAI from '@/utils/openai'; +const loading = ref(false); const textOver = ref(false); const isOnline = ref(false); const ports = [8000, 8080, 8001, 8081]; @@ -57,6 +59,8 @@ const aihtml = ref(''); const infoDialogStatus = ref(false); const setupDialogStatus = ref(false); +loading.value = true; + port.value = await portStorage.getValue(); const auth = await authStorage.getValue(); @@ -65,7 +69,7 @@ username.value = auth.username; password.value = auth.password; // devmode -if (process.env.NODE_ENV === 'development') { +if (isDev) { port.value = constant.devPort; username.value = constant.devUsername; password.value = constant.devUsername; @@ -90,6 +94,7 @@ async function getContent( tip: false, } ) { + loading.value = true; html.value = ''; const tabs = await browser.tabs.query({ active: true, currentWindow: true }); @@ -103,9 +108,10 @@ async function getContent( message: '获取文章', }); - html.value = response.content; + html.value = response?.content; + loading.value = false; md.value = await html2md(html.value); - title.value = response.title; + title.value = response?.title; if (title.value.length > 30) { textOver.value = true; } @@ -123,7 +129,10 @@ onMounted(async () => { // const bg = chrome.extension.getBackgroundPage(); // // @ts-ignore // bg!.popUp(); - const isDark = await isDarkModeStorage.getValue(); + let isDark = await isDarkModeStorage.getValue(); + if (isDev) { + isDark = true; + } if (isDark) { document.documentElement.classList.add('dark'); } @@ -394,6 +403,7 @@ const toggleInfoDialog = () => {