微信小程序 渲染层网络错误_渲染层网络层错误 微信小程序开发 - 云计算资讯 - 服务器之家...

渲染层网络层错误 微信小程序开发

发布时间:2017-04-16

来源:服务器之家

自学微信小程序,用小程序做了个小项目,踩了一些坑:

坑一:

VM2507:1 Sat Feb 04 2017 21:46:27 GMT+0800 (中国标准时间) 渲染层错误

VM2507:2 SyntaxError: Invalid or unexpected token

(anonymous) @ VM2507:2

VM2509:1 Sat Feb 04 2017 21:46:27 GMT+0800 (中国标准时间) 渲染层错误

VM2509:2 webviewScriptError

Invalid or unexpected token

SyntaxError: Invalid or unexpected token

(anonymous) @ VM2509:2

VM2510:1 Sat Feb 04 2017 21:46:27 GMT+0800 (中国标准时间) 渲染层错误

VM2510:2 Uncaught SyntaxError: Invalid or unexpected token

(anonymous) @ VM2510:2

VM2511:1 Sat Feb 04 2017 21:46:27 GMT+0800 (中国标准时间) 渲染层错误

VM2511:2 ReferenceError: $gwx is not defined

(anonymous) @ VM2511:2

VM2512:1 Sat Feb 04 2017 21:46:27 GMT+0800 (中国标准时间) 渲染层错误

VM2512:2 webviewScriptError

$gwx is not defined

ReferenceError: $gwx is not defined

(anonymous) @ VM2512:2

VM2513:1 Sat Feb 04 2017 21:46:27 GMT+0800 (中国标准时间) 渲染层错误

VM2513:2 Uncaught ReferenceError: $gwx is not defined

出现 $gwx is not defined

这个报错位置提示没有任何意义,因为index.whtml我好几天没有动过了;

这个错误后来发现  在刚改过的whtml 页面 想写"¥{{user.salary}}/时 "   结果写成了"${{user.salary}}/时" , 将 ¥ 写成了$;

坑二

封装了一下微信提供的网络访问接口,结果服务器端死活获取不到传递的参数,最后上网一查,post请求的header必须将content-type设置为 'application/x-www-form-urlencoded',否则后台就接收不到数据,而我设置的是'application/json' ,没有其它原因,因为我就是想传递json数据啊,另外POST必须要大写,这点接口文档上写了,正确

function request(param) {

var obj ={

url: param.url,

header: {

'content-type': 'application/x-www-form-urlencoded', /****注意:post方式必须这样设置,否则后台获取不到参数 */

/***'content-type': 'application/json',**/

},

method:'POST',/***注意post必须大写 */

data:param.data==undefined ? "":param.data,

success: function( res ) {

/**console.log(res.data); */

if(param.success && typeof(param.success) =="function" ){

param.success(res);

}

},

fail: function( res ) {

if(param.fail && typeof(param.fail) =="function" ){

param.fail(res);

}

}

}

if(app.globalData.token){

obj.header.access=app.globalData.token;

}

/**

console.log( obj.url)

console.log(JSON.stringify(obj.data) );

*/

wx.request(obj);

}

  • 0
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值