- 报错 Error: Expected updated data but...
小程序报错 [代码]Expected updated data but get first rendering data;Expected updated data but get first rendering data[代码] [代码]Error: Expected updated data but get first rendering data[代码] 在开发工具上会二次渲染,但是在手机上就不能了,而且这个报错是时有时无的,求大神分享一下报错的原因,该如何排查呢 在网上也有人遇见同样的问题了 解决方案:在app.js中还没有给globalData赋值时却提前跳转到了调用globalData数据的页面,所以导致渲染失败,个人建议做个引导或加载页面,给数据一个缓冲的过程; 我在App.js里的代码 [代码]App({[代码][代码] [代码][代码]onLaunch: [代码][代码]function[代码] [代码]() {[代码][代码] [代码][代码]this[代码] [代码].getOpenid().then(()=>{[代码][代码] [代码][代码]return[代码] [代码]that.setAdmin()[代码][代码] [代码][代码]})[代码][代码] [代码][代码]},[代码][代码] [代码][代码]getOpenid: [代码][代码]function[代码] [代码]() {[代码][代码] [代码][代码]var[代码] [代码]that = [代码][代码]this[代码][代码] [代码][代码]return[代码] [代码]new[代码] [代码]Promise( [代码][代码]function[代码] [代码](resolve, reject) {[代码][代码] [代码][代码]wx.getStorage({[代码][代码] [代码][代码]key: [代码][代码]'openid'[代码] [代码],[代码][代码] [代码][代码]success: [代码][代码]function[代码] [代码](res) {[代码][代码] [代码][代码]that.globalData.openId = res.data[代码][代码] [代码][代码]return[代码] [代码]resolve( [代码][代码]'app.js login success'[代码] [代码])[代码][代码] [代码][代码]},[代码][代码] [代码][代码]fail: [代码][代码]function[代码] [代码]() {[代码][代码] [代码][代码]wx.login({[代码][代码] [代码][代码]success: res => {[代码][代码] [代码][代码]var[代码] [代码]code = res.code; [代码][代码]//返回code[代码][代码] [代码][代码]var[代码] [代码]appId = [代码][代码] [代码][代码]var[代码] [代码]secret = [代码][代码] [代码][代码]wx.request({[代码][代码] [代码][代码]url: [代码][代码]'https://api.weixin.qq.com/sns/jscode2session?appid='[代码] [代码]+ appId + [代码][代码]'&secret='[代码] [代码]+ secret + [代码][代码]'&js_code='[代码] [代码]+ code + [代码][代码]'&grant_type=authorization_code'[代码] [代码],[代码][代码] [代码][代码]data: {},[代码][代码] [代码][代码]header: {[代码][代码] [代码][代码]'content-type'[代码] [代码]: [代码][代码]'json'[代码][代码] [代码][代码]},[代码][代码] [代码][代码]success: [代码][代码]function[代码] [代码](res) {[代码][代码] [代码][代码]wx.setStorage({[代码][代码] [代码][代码]key: [代码][代码]"openid"[代码] [代码],[代码][代码] [代码][代码]data: res.data.openid[代码][代码] [代码][代码]})[代码][代码] [代码][代码]that.globalData.openId = res.data.openid[代码][代码] [代码][代码]return[代码] [代码]resolve( [代码][代码]'app.js login success'[代码] [代码])[代码][代码] [代码] [代码] [代码][代码]}[代码][代码] [代码][代码]})[代码][代码] [代码][代码]}[代码][代码] [代码][代码]})[代码][代码] [代码][代码]}[代码][代码] [代码][代码]})[代码][代码] [代码][代码]})[代码][代码] [代码][代码]},[代码][代码] [代码][代码]setAdmin: [代码][代码]function[代码] [代码]() {[代码][代码] [代码][代码]var[代码] [代码]that = [代码][代码]this[代码][代码] [代码][代码]return[代码] [代码]new[代码] [代码]Promise( [代码][代码]function[代码] [代码](resolve, reject) {[代码][代码] [代码][代码]wx.request({[代码][代码] [代码][代码]url: [代码][代码]'http://132.232.22.140:8889/api/club/adminComfirm'[代码] [代码],[代码][代码] [代码][代码]method: [代码][代码]'post'[代码] [代码],[代码][代码] [代码][代码]data:{[代码][代码] [代码][代码]id:that.globalData.openId[代码][代码] [代码][代码]},[代码][代码] [代码][代码]header:{[代码][代码] [代码][代码]"content-type"[代码] [代码]: [代码][代码]'application/json'[代码][代码] [代码][代码]},[代码][代码] [代码][代码]success: [代码][代码]function[代码] [代码](res){[代码][代码] [代码][代码]if[代码] [代码](res.data.code ==300){[代码][代码] [代码][代码]wx.reLaunch({[代码][代码] [代码][代码]url: [代码][代码]'../../pages/findpage/index'[代码] [代码],[代码][代码] [代码][代码]})[代码][代码] [代码][代码]}[代码][代码] [代码][代码]if[代码] [代码](res.data.code == 200){[代码][代码] [代码][代码]that.globalData.myclub = res.data.clubnumber[代码][代码] [代码][代码]that.globalData.myname = res.data.name[代码][代码] [代码][代码]that.globalData.adminOn = [代码][代码]true[代码][代码] [代码][代码]wx.reLaunch({[代码][代码] [代码][代码]url: [代码][代码]'../../pages/index/index'[代码] [代码],[代码][代码] [代码][代码]})[代码][代码] [代码][代码]}[代码][代码] [代码][代码]}[代码][代码] [代码][代码]})[代码][代码] [代码][代码]})[代码][代码] [代码][代码]},[代码][代码] [代码][代码]globalData: {[代码][代码] [代码][代码]userInfo: [代码][代码]null[代码] [代码],[代码][代码] [代码][代码]openId: [代码][代码]null[代码] [代码],[代码][代码] [代码][代码]myclub: [代码][代码]null[代码] [代码],[代码][代码] [代码][代码]myname: [代码][代码]null[代码] [代码],[代码][代码] [代码][代码]adminOn: [代码][代码]false[代码] [代码],[代码][代码] [代码][代码]findClub: [代码][代码]null[代码] [代码],[代码][代码] [代码][代码]findClubNumber: [代码][代码]null[代码][代码] [代码][代码]}[代码][代码]})[代码]因为之前就遇见过页面初始化完成之后没有得到数据,所以我在首页设置的是一个空页面 app.json [代码]"pages" [代码][代码]: [[代码][代码] [代码][代码]"pages/midware/index" [代码][代码],[代码][代码] [代码][代码]"pages/index/index" [代码][代码],[代码][代码] [代码][代码]"pages/findpage/index" [代码][代码],[代码][代码] [代码][代码]"pages/signup/index" [代码][代码],[代码][代码] [代码][代码]"pages/join/index" [代码][代码],[代码][代码] [代码][代码]"pages/option/index" [代码][代码],[代码][代码] [代码][代码]"pages/details/index" [代码][代码],[代码][代码] [代码][代码]"pages/setting/index" [代码][代码],[代码][代码] [代码][代码]"pages/memo/index"[代码][代码] [代码][代码]],[代码]第一个就是空页面,然后主页面的选择在上面App.js里面来判断的,按道理来说,在页面初始化过程中除了对globalData进行赋值之外没有任何取值的操作呀
2018-08-01 - 苹果无法播放m3u8格式视频,安卓机下可以
视频流测试的地址是:http://ivi.bupt.edu.cn/hls/cctv1hd.m3u8 在苹果手机中,video组件无法播放视频,在安卓手机上可以
2018-11-21 - canvas为什么不支持修改字体呢?
我们的小程序是使用canvas制作图文卡片,但是字体需要有多元化的。 -目前在开发工具里,画布可以显示不同的字体,但到了真机上就不行,安卓和苹果手机都不可以。 希望官方重视和解决这个问题,谢谢~
2018-08-01 - 支持原生组件的字体可以被 loadFontFace 需求
- 需求的场景描述(希望解决的问题) canvas自定义字体的需求 - 希望提供的能力 支持原生组件的字体可以被 loadFontFace 需求, 目前不支持修改原生组件的字体,包括 canvas,cover-view 等 这个能不能告诉我们确实改进时间啊,
2018-09-19 - 微信小程序如何隐藏scroll-view滚动条
[代码]::-webkit-scrollbar {[代码] [代码]width[代码][代码]: [代码][代码]0[代码][代码];[代码] [代码]height[代码][代码]: [代码][代码]0[代码][代码];[代码] [代码]color[代码][代码]: [代码][代码]transparent[代码][代码];[代码] [代码]}[代码]scroll-view 使用上述代码 无法隐藏滚动条,ios 上 有的时候有,有的时候没有
2018-04-24 - 写文件的路径是什么规则?写入没权限啊
FileSystemManager.writeFile(Object object) filePath 文件路径怎么写? 我用的 wxfile://tmp_xxx.mp3 或 /tmp/tmp_xxx.mp3 都写不了,这个路径有什么要求么?也没查到有文档说明 fail permission denied.
2018-07-09