Skip to content
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

[Upload] requestMethod返回promise对象未正确触发success问题 #2345

Open
WangBaoCaiGitHub opened this issue Sep 8, 2023 · 3 comments

Comments

@WangBaoCaiGitHub
Copy link

tdesign-miniprogram 版本

1.2.2

重现链接

No response

重现步骤

填写uploadMethod参数,返回Promise对象,未正确触发success

源码中upload.js 71行 存在问题,这样的写法无法正确触发Promise.then 和 catch

image

可修改为这样

return Promise.resolve().then(()=>{
    const task = this.data.requestMethod(files);
    if (task instanceof Promise) {
        return task;
    }
    return Promise.resolve({});
})

期望结果

No response

实际结果

No response

基础库版本

3.0.1

补充说明

No response

@github-actions
Copy link
Contributor

github-actions bot commented Sep 8, 2023

👋 @WangBaoCaiGitHub,感谢给 TDesign 提出了 issue。
请根据 issue 模版确保背景信息的完善,我们将调查并尽快回复你。

@tankle0
Copy link

tankle0 commented Nov 30, 2023

image
@anlyyao 确实不会触发,我这边也复现了,TDesign: 1.2.3,基础库:3.2.0
按照@WangBaoCaiGitHub 修改,触发正常,@anlyyao 烦请确认下~
image

@tankle0
Copy link

tankle0 commented Nov 30, 2023

tdesign-miniprogram 版本

1.2.2

重现链接

No response

重现步骤

填写uploadMethod参数,返回Promise对象,未正确触发success

源码中upload.js 71行 存在问题,这样的写法无法正确触发Promise.then 和 catch

image

可修改为这样

return Promise.resolve().then(()=>{
    const task = this.data.requestMethod(files);
    if (task instanceof Promise) {
        return task;
    }
    return Promise.resolve({});
})

期望结果

No response

实际结果

No response

基础库版本

3.0.1

补充说明

No response

给他们提PR~

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