欧美bbbwbbbw肥妇,免费乱码人妻系列日韩,一级黄片

小程序?qū)崿F(xiàn)發(fā)表評論功能

 更新時間:2018年07月06日 16:32:53   作者:Acitylion  
這篇文章主要為大家詳細(xì)介紹了小程序?qū)崿F(xiàn)發(fā)表評論功能,具有一定的參考價值,感興趣的小伙伴們可以參考一下

本文實例為大家分享了小程序?qū)崿F(xiàn)發(fā)表評論功能的具體代碼,供大家參考,具體內(nèi)容如下

1.點擊發(fā)表按鈕 判斷內(nèi)容是否為空 如果為空提示請輸入內(nèi)容

2.如果內(nèi)容不為空 將評論框里輸入的內(nèi)容的值傳入評論列表

<view wx:for="{{release}}" class='shoppcall comment' data-id="{{item.id }}">
      
      <button class='revoke' bindtap='binddelete' data-id='{{index}}'>撤銷</button>
      
      <view class='publish'>
      <image src='https://storage.confolsc.com/storage/image/9f37e8a1fadc7ee20964dd6de7edeb4dbb4b03a1?size=130,130&t=1&redirect=1'></image>
      
      <view class='publish_list'>
       <text class='publish_list_item'>{{item.name}}</text>
       <view class='like'>
        <text class='publish_time'>{{item.time}}</text>
         <view class='like_num_list' bindtap='bindlike' data-id='{{index}}'>
          <text class='iconfont icon-dianzan2' style='{{item.likes.iszan?"color:red":"color:black"}}'></text>
          
          <text class='like_num'>{{item.likes.num}}</text>
         </view>
        
       </view>
       
       <text class='redtree_text'>{{item.textareaValue}}</text>
      </view>
      </view>
     
     
    </view>  
 
    <view wx:if='{{release.length == 0}}'>
     暫無評論
    </view>
</view>
// 點擊發(fā)表評論
 formSubmit: function (e) {
  console.log('form發(fā)生了submit事件,攜帶數(shù)據(jù)為:', e.detail.value)
   if ( e.detail.value.input == '') {
   wx.showToast({
    title: '請輸入內(nèi)容',
   })
 
  } else {
   var that = this;
   var textarea_item = {};
   var textareaValue= e.detail.value.input;
   
   var release = this.data.release;
   var id = release.length 
   textarea_item.textareaValue = textareaValue;
 
    release.push(textarea_item);// 將評論內(nèi)容添加到評論列表
 
 
   this.setData({
    
    release: release,
    releaseFocus: true, //隱藏輸入框
    releaseValue : '' //清空輸入框內(nèi)容
   })
   console.log(release)
   
 
  }  
  
 },

發(fā)表完內(nèi)容清空內(nèi)容隱藏輸入框

以上就是本文的全部內(nèi)容,希望對大家的學(xué)習(xí)有所幫助,也希望大家多多支持腳本之家。

相關(guān)文章

最新評論