怎么在分享成功的会回调里执行api外的自定义函数?

发布于 8 年前作者 weigao10513 次浏览最后编辑 8 年前来自 ask
wx.shareAppMessage({
                title: "",
                path: '/pages/share/share?id=123',
                imageUrl: '',
                success(res){
                    console.log("转发成功!!!");
                        this.test();
                    }
                },

……


test: function(){
       console.log("-----------2222222");
   },

要执行这样的效果要怎么做?  现在这样就是就是直接报:this.test is not a function; at api shareAppMessage success callback function……

跪求各位大牛指点一二!!!

1 回复
xia18
xia181 楼6 年前

外面定义 var that=this,里面的this换成that