From 40f4449070a60c4bac2c3279f941fb1c215fa786 Mon Sep 17 00:00:00 2001 From: zhaojinfeng <121016171@qq.com> Date: Sun, 23 Jul 2023 01:43:29 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E7=82=B9=E5=87=BB=E6=97=A0=E5=93=8D?= =?UTF-8?q?=E5=BA=94?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- packages/download-link/index.vue | 6 ++++-- stories/DownloadLink.stories.ts | 4 ++-- types/components.d.ts | 1 + 3 files changed, 7 insertions(+), 4 deletions(-) diff --git a/packages/download-link/index.vue b/packages/download-link/index.vue index 2c6b51b..8080a9b 100644 --- a/packages/download-link/index.vue +++ b/packages/download-link/index.vue @@ -2,7 +2,7 @@ * @Author: zhaojinfeng 121016171@qq.com * @Date: 2023-07-21 01:21:34 * @LastEditors: zhaojinfeng 121016171@qq.com - * @LastEditTime: 2023-07-22 14:15:32 + * @LastEditTime: 2023-07-23 01:34:25 * @FilePath: \vue3\packages\download-link\index.vue * @Description: 现在组件 * @@ -48,12 +48,12 @@ async function reload(id: string | number) { const res = await props.request(id) url = res.url fileName = res.name + type = 'primary' } catch (error) { type = 'danger' } finally { - type = 'success' loading = false } } @@ -88,6 +88,8 @@ function init() { watch(() => props.src, init) +tryOnMounted(init) + tryOnUnmounted(() => { if (url.startsWith('blob:')) { // revoke object URL after use to avoid memory leak. diff --git a/stories/DownloadLink.stories.ts b/stories/DownloadLink.stories.ts index f25fe3e..6b675eb 100644 --- a/stories/DownloadLink.stories.ts +++ b/stories/DownloadLink.stories.ts @@ -2,7 +2,7 @@ * @Author: zhaojinfeng 121016171@qq.com * @Date: 2023-07-21 12:25:52 * @LastEditors: zhaojinfeng 121016171@qq.com - * @LastEditTime: 2023-07-22 14:38:22 + * @LastEditTime: 2023-07-23 01:43:20 * @FilePath: \vue3\stories\DownloadLink.stories.ts * @Description: * @@ -23,7 +23,7 @@ const meta = { * 可以是文件名或URL。 * */ - src: '文件ID', + src: 'https://www.bingimg.cn/down/OHR.TeaEstate_ZH-CN9645412630_1920x1080.jpg', /** 文件信息请求函数 */ request: () => Promise.resolve({ url: avatar, diff --git a/types/components.d.ts b/types/components.d.ts index ce24d30..5a9a5c1 100644 --- a/types/components.d.ts +++ b/types/components.d.ts @@ -13,6 +13,7 @@ declare module 'vue' { ElCol: typeof import('element-plus/es')['ElCol'] ElConfigProvider: typeof import('element-plus/es')['ElConfigProvider'] ElDialog: typeof import('element-plus/es')['ElDialog'] + ElEmpty: typeof import('element-plus/es')['ElEmpty'] ElForm: typeof import('element-plus/es')['ElForm'] ElFormItem: typeof import('element-plus/es')['ElFormItem'] ElIcon: typeof import('element-plus/es')['ElIcon']