微信小程序本作用域下调用全局JS详解
本地wxml文件
<view> app版本:pw_version </view>
本地js文件
var app; Page({ data:{ }, onLoad:function() { app = getApp(); this.setData({version:app.globalData.appName}); } })
全局js文件
//app.js App({ globalData:{ appName:"hcoder" }, test:function () { console.log("ok"); } })
The above is the detailed content of How to call global JavaScript in this scope. For more information, please follow other related articles on the PHP Chinese website!