微信小程序—使用全局方法 1、在app.js里定义全局方法,例如getData()方法 2、在index.js里使用全局方法getData() 首先获取全局let app = getApp(); 然后app.getData()就可以使用了。