html52.com
我爱小程序-开发者交流社区

WXML bindtap 只能调用一次

框架类型 问题类型 终端类型 微信版本 基础库版本
小程序 Bug 微信安卓客户端 最新 最新
<view class="weui-uploader__input-box">
   <view class="weui-uploader__input" bindtap="chooseVideo"></view>
</view>


    async chooseVideo(e) {
        console.log("chooseVideo 调用了1次")
        this.setData({
            chooseVideoStatus: "loading"
        })
        await wx.chooseMedia({
            count: 1,
            mediaType: ['video'],
            sourceType: ['album''camera'],
            maxDuration: 30,
            success: res => {
                // console.log(res.tempFiles[0].tempFilePath)
                this.chooseVideo = res.tempFiles[0].tempFilePath;
                this.setData({
                    chooseCover: res.tempFiles[0].thumbTempFilePath,
                }, () => {
                    const id = setTimeout(() => {
                        this.setData({
                            chooseVideoStatus: "choose"
                        });
                        clearTimeout(id);
                    }, 2000)
                })
            },
            fail: err => {
                console.log('choose Media fail.')
                this.setData({
                    chooseVideoStatus: null
                })
            }
        })
    },



                })
            }
        })
    },
经过测试,将 chooseVideo 改成其他名称后,运行正常。


经过测试,将 chooseVideo 改成其他名称后,运行正常。

怀疑是 因为自定义函数 和 wx.chooseVideo 冲突。

网友回复

stop eating:
this.chooseVideo = res.tempFiles[0].tempFilePath  这行代码搞的鬼

评论 抢沙发

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址

真正的个人免签约支付接口

云免签H5支付