微信小程序-組件封裝相似picker,模態框彈出全屏和半屏,多選,單選,日期選擇器

dome下載地址: https://github.com/han-guang-xue/WX-Dialogcss

目前封住的功能比較有限,有需求評論區留言:再完善 (好比 高度可設置,樣式控制,標籤傳參等)git

下載dome 完以後打開文件夾:WX-Dialog\component\Dialoggithub

  Dialog目錄下是微信小程序的目錄結構,so,使用微信開發者工具導入代碼片斷或是項目,小程序

 

 

 

1.組件使用方式: 將組件所有封裝在該目錄下微信小程序

 

 

 

2.組件引用微信

 

 

 3.如下是使用案例,配置好組件路徑,拷貝到頁面使用便可微信開發

 <view class="text_1" style="width:100rpx;height:200rpx;background:#000;">
  <dialog type="singleRow" isFull="false" methodSuccess="evenP" bindevenP="getCurDomeDate" 
    lableTitle="選擇標籤頁標題" default_value="4天" otherData="1天,2天,3天,4天,5天">
    <view style="width:500rpx;height:100rpx;background:#cdcdcd;">單列表滾動 點我</view>
  </dialog>
</view>


<dialog type="date" isFull="false" methodSuccess="evenP" bindevenP="getCurDomeDate" >
  <view class="form_select_value">
    <view style="width:500rpx;height:100rpx;background:#CDCDCD;">日曆插件(date) 點我</view>
  </view>
</dialog>

<dialog type="date" isFull="false" methodSuccess="evenP" bindevenP="getCurDomeDate" default_value="2020-03-05">
  <view class="form_select_value">
    <view style="width:500rpx;height:100rpx;background:#CDCDCD;margin-top:10rpx">日曆 默認選中時間(date) 點我
      <view>2020-03-05(選中特定日期)</view>
    </view>
  </view>
</dialog>

<dialog type="date" isFull="false" methodSuccess="evenP" bindevenP="getCurDomeDate" default_value="2020-04-00">
  <view class="form_select_value">
    <view style="width:500rpx;height:100rpx;background:#CDCDCD;margin-top:10rpx">日曆 默認選中時間(date) 點我
      <view>2020-03-00(選中特定月份)</view>
    </view>
  </view>
</dialog>


<dialog type="date" isFull="false" methodSuccess="evenP" bindevenP="getCurDomeDate" default_value="2020-00-00">
  <view class="form_select_value">
    <view style="width:500rpx;height:100rpx;background:#CDCDCD;margin-top:10rpx">日曆 默認選中時間(date) 點我
      <view>2020-00-00(選中特定年)</view>
    </view>
  </view>
</dialog>




<dialog type="radio" isFull="true" methodSuccess="evenP" bindevenP="getCurDomeDate1" multiSelect="N"
  otherData="good,nice,veryNice" default_value="nice">
   <view style="width:500rpx;height:100rpx;background:#CDCDCD;margin-top:30rpx;">單選</view>
</dialog>


<dialog type="radio" isFull="true" methodSuccess="evenP" bindevenP="getCurDomeDate1" multiSelect="Y"
  otherData="good,nice,veryNice" default_value="nice">
   <view style="width:500rpx;height:100rpx;background:#CDCDCD;margin-top:30rpx;">多選 (相比單選只須要修改參數multiSelect)</view>
</dialog>

 

 5.使用截圖(若是不喜歡樣式,能夠經過dialog.css本身去修改)dom

 

 

 

 6.注  bindevenP 指定的getCurDomeDate函數須要在js文件中自定義函數

 

bindevenP="getCurDomeDate"

eg:工具

  getCurDomeDate:function(e){
    console.log(e)
    console.log("返回數據:" + e.detail)
  }

相關文章
相關標籤/搜索