在小程序的js文件中,有时候我们也要复用同一js的一个或多个方法。如下即可
/**
* 生命周期函数–监听页面显示
*/
onShow: function (options) {
var that=this;
that.queryCartList();
},
queryCartList:function(){
console.log(‘ok’)
}
上面代码是在onShow方法调用queryCartList方法,可以看出打印出了queryCartList里面的输出。
