网友真实露脸自拍10p,成人国产精品秘?久久久按摩,国产精品久久久久久无码不卡,成人免费区一区二区三区

小程序模板網

微信小程序接受asp.net 返回的json值處理,判斷是否是手機號,文字超過行后隱藏

發布時間:2018-02-06 15:33 所屬欄目:小程序開發教程
 
 

	
  1. wx.request({
  2. url: 'https://l網址er.aspx',
  3. data: {
  4. openId: wx.getStorageSync('openId'),
  5. requestType: "query"
  6. },
  7. success: function (response) {
  8. //
  9. //console.log(response)
  10. //console.log(response.data)
  11. //console.log(response.statusCode)
  12. if (response.statusCode == '200') {
  13. var count = response.data.indexOf("\r\n\r\n<!DOC");
  14. var str = response.data.substring(0, count)
  15. var json = JSON.parse(str)
  16. //保存信息
  17. console.log(str+"長度" + json.length)
  18. } else {
  19. wx.showToast({
  20. title: '信息讀取失敗,請聯系客服!',
  21. icon: 'success',
  22. duration: 1500
  23. })
  24. }
  25. }
  26. });
 

二:判斷是否是手機號

 

	
  1. validatemobile: function (mobile) {
  2. if (mobile.length == 0) {
  3. wx.showToast({
  4. title: '請輸入手機號!',
  5. icon: 'success',
  6. duration: 1500
  7. })
  8. return false;
  9. }
  10. if (mobile.length != 11) {
  11. wx.showToast({
  12. title: '手機號長度有誤!',
  13. icon: 'success',
  14. duration: 1500
  15. })
  16. return false;
  17. }
  18. var myreg = /^(((13[0-9]{1})|(15[0-9]{1})|(18[0-9]{1})|(17[0-9]{1}))+\d{8})$/;
  19. if (!myreg.test(mobile)) {
  20. wx.showToast({
  21. title: '手機號有誤!',
  22. icon: 'success',
  23. duration: 1500
  24. })
  25. return false;
  26. }
  27. return true;
  28. }
 

三:文字超過行后隱藏顯示省略號

 

	
  1. text{
  2.  
  3. overflow:hidden;
  4. //超出一行文字自動隱藏
  5.  
  6. text-overflow:ellipsis;//文字隱藏后添加省略號
  7.  
  8. white-space:nowrap;
  9. //強制不換行
  10.  
  11. }

或者多行的用這些:

 

	
  1. display: -webkit-box;
  2.  
  3. word-break: break-all;
  4.  
  5. text-overflow: ellipsis;
  6.  
  7. font-size: 32rpx;
  8.  
  9. overflow: hidden;
  10.  
  11. -webkit-box-orient: vertical;
  12.  
  13. -webkit-line-clamp:2;


易優小程序(企業版)+靈活api+前后代碼開源 碼云倉庫:starfork
本文地址:http://www.xiuhaier.com/wxmini/doc/course/21628.html 復制鏈接 如需定制請聯系易優客服咨詢:800182392 點擊咨詢
QQ在線咨詢
AI智能客服 ×