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

After the jump of tag a, the channels of dart and js are no longer useful #652

Closed
1 task done
chengming111 opened this issue Aug 22, 2024 · 8 comments
Closed
1 task done
Assignees
Labels
bug Something isn't working

Comments

@chengming111
Copy link

Affected version

0.16.2

Flutter versions

3.22.3

No same issues found.

  • Yes, I search all issues but not found.

Steps to Reproduce

After clicking the Submit button on the homepage, the loading animation can be displayed normally, but after the page jumps, an error message appears when clicking the Submit button.

Code example

  1. There is a function 'submitMap' in plugin
    submitMap(jsonString) {
    return webf.methodChannel.invokeMethod('submitMap', jsonString);
    }

  2. in dart
    case 'submitMap':
    showLoading();
    // Simulate processing, hide the loading after 2 seconds
    await Future.delayed(Duration(seconds: 2));
    hiddenLoading();
    onSubmit(args[0]);
    return null;

  3. In html and js, I have
    提交

    const submit = document.getElementById('submit');
    submit.addEventListener('click', async(e) => {
    ......
    await window.form.submitMap(jsonString);
    });

Expected results

loading animation

Actual results

截屏2024-08-22 16 16 09

@chengming111 chengming111 added the bug Something isn't working label Aug 22, 2024
@andycall
Copy link
Member

let me check it out

@chengming111
Copy link
Author

非常感谢您的回复。请问您查看了吗,可以正常使用吗

@andycall
Copy link
Member

近期都在处理商业技术支持(24小时内响应),社区支持只能在空闲时间搞一下,平均响应时间在 1-2 周。

最近客户需求有点多,还请耐心等待

@andycall andycall self-assigned this Aug 26, 2024
@andycall
Copy link
Member

@chengming111

window.form

这个是在哪里定义的,你在哪里注入了一个脚本来实现了这个函数?

@chengming111
Copy link
Author

您好,我在assets/plugin/base_plugin.js 中定义的

class Form {
    constructor() {};

    // 用户点击提交按钮后,将数据传回dart
    submitMap(jsonString) {
        return webf.methodChannel.invokeMethod('submitMap', jsonString);
    }

  
}
window.form = new Form();

@andycall
Copy link
Member

andycall commented Sep 2, 2024

通过 script 标签引入的吗

@chengming111
Copy link
Author

是的

@andycall
Copy link
Member

andycall commented Sep 8, 2024

@chengming111 我尝试按你的步骤写了个 demo,但是依然没有复现,具体有关跳转的操作没有提供相应的代码。

https://github.com/andycall/webf-issue-demo-652

需要提供可复现的 demo

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants