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

小程序模板網(wǎng)

微信小程序表單驗證錯誤提示

發(fā)布時間:2018-04-18 11:09 所屬欄目:小程序開發(fā)教程

表單驗證 點擊確認(rèn)發(fā)布不能為空錯誤提示 
以下是效果圖:

代碼如下:

 

WXML:

 

				
  1. [html] view plain copy print?在CODE上查看代碼片派生到我的代碼片
  2. <view class="ad_popError" wx:if="{{popErrorMsg}}">{{popErrorMsg}}</view>
  3. <view class="ad_popFt">
  4. <form bindsubmit="goDetail" >
  5. <textarea class="ad_popArea" bindinput="commentTxtFn" focus="{{isPopOpen}}" placeholder="請輸入留言內(nèi)容" placeholder-style="color:#cccccc;" name="textarea" />
  6. <view class="ad_popCout">
  7. <text class="one_star">你還可以輸入</text>
  8. <text class="one_stars {{!!tips?'danger':''}}">{{commentTxtCount}}</text>
  9. <text class="one_star">字</text>
  10. </view>
  11. <button class="informBtn" form-type="submit">確認(rèn)發(fā)布</button>
  12. </form>
  13. </view>
 

WXSS:

 

				
  1. [css] view plain copy print?在CODE上查看代碼片派生到我的代碼片
  2. page{background: #f4f4f4;}
  3. .ad_popHd{height: 76rpx; line-height: 76rpx; font-size: 32rpx;text-align: center; border-bottom: 1px solid #cdd1cd; padding: 0 20rpx;color: #202120;}
  4. .ad_popFt{ margin: 20rpx ; margin-top: 50rpx;}
  5. .ad_popArea{ width: 708rpx; height:400rpx;font-size:30rpx;padding: 20rpx; box-sizing: border-box; -webkit-box-sizing: border-box; line-height: 40rpx; color: #333; background: #fff; }
  6. .ad_popCout{ color: #969899; font-size: 24rpx; text-align: right; line-height: 58rpx; padding: 0 20rpx;}
  7. .informBtn{background: #09bb07;color: #fff;font-size: 34rpx; margin-top: 38rpx;height: 88rpx;}
  8. .one_stars{color: #999;}
  9. .one_star{font-size: 20rpx;color: #999;}
  10. .danger{ color: #f64400;}
  11. .ad_popError{ background: #de352d; color: #fff; height: 58rpx; line-height: 58rpx; font-size: 24rpx; text-align: center; position: absolute; left: 0; top: 0; width: 100%; z-index:3;}
 

JS:

 

				
  1. [javascript] view plain copy print?在CODE上查看代碼片派生到我的代碼片
  2. // pages/informLeaveMsg/informLeaveMsg.js
  3. Page({
  4.  
  5. /**
  6. * 頁面的初始數(shù)據(jù)
  7. */
  8. data: {
  9.  
  10. },
  11. //確認(rèn)發(fā)布
  12. goDetail:function(e){
  13. setTimeout(()=>{
  14. var subValue = e.detail.value.textarea
  15. console.log(subValue)
  16. if (subValue == null || subValue == "") {
  17. console.log("不能為空")
  18. this.setData(
  19. { popErrorMsg: "發(fā)布的留言內(nèi)容不能為空" }
  20. );
  21. this.ohShitfadeOut();
  22. return;
  23. }
  24.  
  25. },100)
  26.  
  27. },
  28.  
  29. ohShitfadeOut() {
  30. var fadeOutTimeout = setTimeout(() => {
  31. this.setData({ popErrorMsg: '' });
  32. clearTimeout(fadeOutTimeout);
  33. }, 3000);
  34. },
  35.  
  36. })


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