1.let extConfig = wx.getExtConfigSync? wx.getExtConfigSync(): {}
2.if (wx.getExtConfig) {
wx.getExtConfig({
success (res) {
console.log(res.extConfig)
}
})
}
以上都可以获取ext.json的值,但是在js代码执行优先级上1要高于2,也就是在生命周期调用上建议用1,因为2赋值在需要的生命周期上调用会赋值失败,
网友评论