dome下載地址: https://github.com/han-guang-xue/WX-Dialog
目前封住的功能比較有限,有需求評論區留言:再完善 (比如 高度可設置,樣式控制,標簽傳參等)
下載dome 完之后打開文件夾:WX-Dialog\component\Dialog
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自己去修改)
6.注 bindevenP 指定的getCurDomeDate函數需要在js文件中自定義
bindevenP="getCurDomeDate"
eg:
getCurDomeDate:function(e){ console.log(e) console.log("返回數據:" + e.detail) }