Thanks to visit codestin.com
Credit goes to github.com

Skip to content

vue3 版本的 @file-added 事件会触发两次 #215

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
xakoy opened this issue Mar 6, 2023 · 2 comments
Closed

vue3 版本的 @file-added 事件会触发两次 #215

xakoy opened this issue Mar 6, 2023 · 2 comments

Comments

@xakoy
Copy link

xakoy commented Mar 6, 2023

 <uploader
    :options="options"
    :file-status-text="statusText"
    class="uploader-example"
    ref="uploaderRef"
    @file-complete="fileComplete"
    @file-added="fileAdd"
    @complete="complete"
  ></uploader>
function fileAdd() {
        console.log('file add')
}

结果会打印两次。

看了你的代码,可能是从vue2迁移过来的,vue3的props改版了,事件也会包含在props中。所以会触发两次。

image

@xakoy
Copy link
Author

xakoy commented Mar 6, 2023

看了PR,是这两周添加出来的问题:
8c5d55c

现在临时的解决方法是再加一:on-file-added="beforeFileAdded",这样的属性,而且必须放在@file-added后面。

<uploader
    :options="options"
    :file-status-text="statusText"
    class="uploader-example"
    ref="uploaderRef"
    @file-complete="fileComplete"
    @file-added="fileAdd"
    :on-file-added="beforeFileAdded"
    @complete="complete"
  ></uploader>

希望改进一下,谢谢。

dolymood added a commit that referenced this issue Mar 7, 2023
@dolymood
Copy link
Member

dolymood commented Mar 7, 2023

1.0.1 修复
建议使用 :onFileAdded="onFileAdded"

@dolymood dolymood closed this as completed Mar 7, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants