请选择 进入手机版 | 继续访问电脑版
帖子
帖子
用户
博客
课程
显示全部楼层
157
帖子
1
勋章
3581
Y币

[其他] 多端开发 button type="submit"在小程序上效

[复制链接]
发表于 2022-3-20 14:37:02




<form onsubmit={this.onsubmit}>
<button type="submit" class="login_post" style={'width:'+(api.winWidth-60)+'px;'}>登录</button></form>


onsubmit(e) {
                        //$util.alert(1)
                        //console.log(JSON.stringify(e.detail.value))
                        let d = e.detail.value;
                        let that = this;
                        $util.ajax({
                                path: '&r=wxapp.verification',
                                //method: 'post',
                                mobile: d.mobil,//mobil
                                code: d.yzm,//captcha
                        }, function (res, err) {
                                console.log(JSON.stringify(res));
                                console.log(JSON.stringify(err));
                                if(res.error == 0){
                                $util.toast('登录成功');
                                UserCenter.setUserInfo(res);
                                api.sendEvent({name: 'refresh_login',extra: ''});
                                setTimeout(()=>{
                                api.closeWin();
                                },1000)
                                }else{
                                $util.toast(res.message)
                                }
                        })
                },




157
帖子
1
勋章
3581
Y币
人呐?
没看出来你要问啥
157
帖子
1
勋章
3581
Y币
button  在小程序上面无效,无法递交from的表单内容,也就是不能触发onsubmit的方法
特特法爷 · 2022-3-21 13:14没看出来你要问啥
1
帖子
0
勋章
19
Y币
不是input type="submit"吗?
157
帖子
1
勋章
3581
Y币
兄弟知道我在说什么嘛?
<button type="submit">提交</button>
递交form的表单数据,在微信小程序端无效
lij00 · 2022-3-22 13:17不是input type="submit"吗?
恩,听明白了,我这边让开发给你解答下
10
帖子
1
勋章
5638
Y币
小程序端可以手动添上 form-type:
  1. <button type="submit" form-type="submit">提交</button>
复制代码
jack tang · 2022-3-22 17:40兄弟知道我在说什么嘛?
提交
递交form的表单数据,在微信小程序端无效

157
帖子
1
勋章
3581
Y币
现在就是这样的。。。。
杨永安 · 2022-3-24 13:58小程序端可以手动添上 form-type:
您需要登录后才可以回帖 登录

本版积分规则