|
作者:奋斗放个,来自原文地址 wx.request({ url: 'https://l网址er.aspx', data: { openId: wx.getStorageSync('openId'), requestType: "query" }, success: function (response) { // //console.log(response) //console.log(response.data) //console.log(response.statusCode) if (response.statusCode == '200') { var count = response.data.indexOf("\r\n\r\n<!DOC"); var str = response.data.substring(0, count) var json = JSON.parse(str) //保存信息 console.log(str+"长度" + json.length) } else { wx.showToast({ title: '信息读取失败,请联系客服!', icon: 'success', duration: 1500 }) } } });
二:判断是否是手机号 validatemobile: function (mobile) { if (mobile.length == 0) { wx.showToast({ title: '请输入手机号!', icon: 'success', duration: 1500 }) return false; } if (mobile.length != 11) { wx.showToast({ title: '手机号长度有误!', icon: 'success', duration: 1500 }) return false; } var myreg = /^(((13[0-9]{1})|(15[0-9]{1})|(18[0-9]{1})|(17[0-9]{1}))+\d{8})$/; if (!myreg.test(mobile)) { wx.showToast({ title: '手机号有误!', icon: 'success', duration: 1500 }) return false; } return true; }
三:文字超过行后隐藏显示省略号text{overflow:hidden;//超出一行文字自动隐藏text-overflow:ellipsis;//文字隐藏后添加省略号white-space:nowrap;//强制不换行}
或者多行的用这些: display: -webkit-box; word-break: break-all; text-overflow: ellipsis; font-size: 32rpx; overflow: hidden; -webkit-box-orient: vertical; -webkit-line-clamp:2;
|