fix: 点击无响应

This commit is contained in:
2023-07-23 01:43:29 +08:00
parent 16663000f1
commit 40f4449070
3 changed files with 7 additions and 4 deletions

View File

@ -2,7 +2,7 @@
* @Author: zhaojinfeng 121016171@qq.com * @Author: zhaojinfeng 121016171@qq.com
* @Date: 2023-07-21 01:21:34 * @Date: 2023-07-21 01:21:34
* @LastEditors: zhaojinfeng 121016171@qq.com * @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 * @FilePath: \vue3\packages\download-link\index.vue
* @Description: 现在组件 * @Description: 现在组件
* *
@ -48,12 +48,12 @@ async function reload(id: string | number) {
const res = await props.request(id) const res = await props.request(id)
url = res.url url = res.url
fileName = res.name fileName = res.name
type = 'primary'
} }
catch (error) { catch (error) {
type = 'danger' type = 'danger'
} }
finally { finally {
type = 'success'
loading = false loading = false
} }
} }
@ -88,6 +88,8 @@ function init() {
watch(() => props.src, init) watch(() => props.src, init)
tryOnMounted(init)
tryOnUnmounted(() => { tryOnUnmounted(() => {
if (url.startsWith('blob:')) { if (url.startsWith('blob:')) {
// revoke object URL after use to avoid memory leak. // revoke object URL after use to avoid memory leak.

View File

@ -2,7 +2,7 @@
* @Author: zhaojinfeng 121016171@qq.com * @Author: zhaojinfeng 121016171@qq.com
* @Date: 2023-07-21 12:25:52 * @Date: 2023-07-21 12:25:52
* @LastEditors: zhaojinfeng 121016171@qq.com * @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 * @FilePath: \vue3\stories\DownloadLink.stories.ts
* @Description: * @Description:
* *
@ -23,7 +23,7 @@ const meta = {
* 可以是文件名或URL。 * 可以是文件名或URL。
* *
*/ */
src: '文件ID', src: 'https://www.bingimg.cn/down/OHR.TeaEstate_ZH-CN9645412630_1920x1080.jpg',
/** 文件信息请求函数 */ /** 文件信息请求函数 */
request: () => Promise.resolve({ request: () => Promise.resolve({
url: avatar, url: avatar,

View File

@ -13,6 +13,7 @@ declare module 'vue' {
ElCol: typeof import('element-plus/es')['ElCol'] ElCol: typeof import('element-plus/es')['ElCol']
ElConfigProvider: typeof import('element-plus/es')['ElConfigProvider'] ElConfigProvider: typeof import('element-plus/es')['ElConfigProvider']
ElDialog: typeof import('element-plus/es')['ElDialog'] ElDialog: typeof import('element-plus/es')['ElDialog']
ElEmpty: typeof import('element-plus/es')['ElEmpty']
ElForm: typeof import('element-plus/es')['ElForm'] ElForm: typeof import('element-plus/es')['ElForm']
ElFormItem: typeof import('element-plus/es')['ElFormItem'] ElFormItem: typeof import('element-plus/es')['ElFormItem']
ElIcon: typeof import('element-plus/es')['ElIcon'] ElIcon: typeof import('element-plus/es')['ElIcon']