mpvue开发小程序问题总结

2019-04-10  本文已影响0人  丘比特爱上猫

1. wxml中不支持字符串截取

2. v-html不能使用

3. 数据获取写在生命周期mounted中,其他生命周期阶段可能会出现数据无刷新等状况;

    const _this = this
    wx.getStorage({
      key: 'wxdk',
      success: function(res){
        console.log(res.data)
        _this.info = res.data
      },
      fail: function(){
        wx.showToast({
          title: '获取详情失败',
          duration: 1000
      })
      }
    })

4. POST 请求错误

微信请求默认请求头数据类型为

{"content-type": "application/json"}

post请求时请根据后台处理类型相应修改
例如:

{ "content-type": "application/x-www-form-urlencoded" }
上一篇下一篇

猜你喜欢

热点阅读