帖子
帖子
用户
博客
课程
显示全部楼层
187
帖子
2
勋章
2091
Y币

[开发工具] addEventListener

[复制链接]
发表于 2022-4-6 15:30:53
apiready() {
        this.data.userKey = UserCenter.getAccessToken();
        this.data.appKey = _config.appkey || "0";
        this.GetApplyList();
        console.log("1111111111111111111111111");
        api.addEventListener({
            name: 'tabitembtn'
        }, function (ret) {
            console.log('点击了第' + (ret.index + 1) + '项');
            api.setTabBarAttr({
                index: ret.index
            });
            this.GetApplyList();
        });

        // this.GetorderList();
    },

这个不能调用吗?this.GetApplyList(); 这个调用不了 我要怎么调用当前页面的方法 是AVM


方法写到method  中去调用,看下avm的文档
187
帖子
2
勋章
2091
Y币
  this.GetApplyList(); 这个方法吗?已经是在 method  里面啊
开始定义 let that = this;
然后用that.GetApplyList();
187
帖子
2
勋章
2091
Y币
api.addEventListener({
                        name: 'tabitembtn'
                }, function (ret) {
                        let that = this;
                        console.log('点击了第' + (ret.index + 1) + '项');
                        api.setTabBarAttr({
                                index: ret.index
                        });
                        that.GetApplyList();
                });
    这个样子吗
187
帖子
2
勋章
2091
Y币
可以了    我已经解决了
好的
您需要登录后才可以回帖 登录

本版积分规则