小程序全局变量 引入方式

 
 
onLoad() {
console.log('load')
console.log(this.$parent)
console.log('wepy.$appConfig')
console.log(wepy.$appConfig)
}
 
 
 
 
 
<script>
import wepy from 'wepy'
export default class index extends wepy.page {
config = {
backgroundTextStyle: 'light',
navigationBarBackgroundColor: '#fff',
navigationBarTitleText: '首页',
navigationBarTextStyle: 'black',
enablePullDownRefresh: false
}
data = {
swiper: {
indicatorDots: true,
vertical: false,
autoplay: true,
circular: true,
interval: 2000,
duration: 500,
previousMargin: 0,
nextMargin: 0,
swiperimgUrls: ['tooopen_sy_143912755726.jpg', 'payWeixin.jpg'],
},
commonCfg: {}
}
onLaunch() {}
onLoad() {
this.commonCfg = wepy.$appConfig.common
}
onRoute() {}
onReady() {}
onShow() {}
onHide() {}
onUnload() {}
onReachBottom() {}
onShow() {}
onHide() {}
onUnload() {}
methods = {}
}
</script>
 
 
 
原文地址:https://www.cnblogs.com/rsapaper/p/9576491.html