|
1 | 1 | <template> |
2 | 2 | <view class="uni-date"> |
3 | | - <view class="uni-date-editor--x" :class="{'uni-date-editor--x__disabled': disabled, |
| 3 | + <view @click="show"> |
| 4 | + <slot> |
| 5 | + <view class="uni-date-editor--x" :class="{'uni-date-editor--x__disabled': disabled, |
4 | 6 | 'uni-date-x--border': border}"> |
5 | | - <view v-if="!isRange" class="uni-date-x uni-date-single" @click="show"> |
6 | | - <view class="uni-date__icon-logo"> |
7 | | - <image class="uni-date-editor--logo" :src="iconBase64" mode=""></image> |
8 | | - </view> |
9 | | - <input class="uni-date__input" type="text" v-model="singleVal" :placeholder="placeholder" |
10 | | - :disabled="true" /> |
11 | | - </view> |
12 | | - <view v-else class="uni-date-x uni-date-range" @click="show"> |
13 | | - <view class="uni-date__icon-logo"> |
14 | | - <image class="uni-date-editor--logo" :src="iconBase64" mode=""></image> |
| 7 | + <view v-if="!isRange" class="uni-date-x uni-date-single"> |
| 8 | + <view class="uni-date__icon-logo"> |
| 9 | + <image class="uni-date-editor--logo" :src="iconBase64" mode=""></image> |
| 10 | + </view> |
| 11 | + <input class="uni-date__input" type="text" v-model="singleVal" :placeholder="placeholder" |
| 12 | + :disabled="true" /> |
| 13 | + </view> |
| 14 | + <view v-else class="uni-date-x uni-date-range"> |
| 15 | + <view class="uni-date__icon-logo"> |
| 16 | + <image class="uni-date-editor--logo" :src="iconBase64" mode=""></image> |
| 17 | + </view> |
| 18 | + <input class="uni-date__input uni-date-range__input" type="text" v-model="range.startDate" |
| 19 | + :placeholder="startPlaceholder" :disabled="true" /> |
| 20 | + <slot> |
| 21 | + <view class="">{{rangeSeparator}}</view> |
| 22 | + </slot> |
| 23 | + <input class="uni-date__input uni-date-range__input" type="text" v-model="range.endDate" |
| 24 | + :placeholder="endPlaceholder" :disabled="true" /> |
| 25 | + </view> |
| 26 | + <view v-show="!disabled && (singleVal || (range.startDate && range.endDate))" |
| 27 | + class="uni-date__icon-clear" @click="clear"> |
| 28 | + <uni-icons type="clear" color="#e1e1e1" size="14"></uni-icons> |
| 29 | + </view> |
15 | 30 | </view> |
16 | | - <input class="uni-date__input uni-date-range__input" type="text" v-model="range.startDate" |
17 | | - :placeholder="startPlaceholder" :disabled="true" /> |
18 | | - <slot> |
19 | | - <view class="">{{rangeSeparator}}</view> |
20 | | - </slot> |
21 | | - <input class="uni-date__input uni-date-range__input" type="text" v-model="range.endDate" |
22 | | - :placeholder="endPlaceholder" :disabled="true" /> |
23 | | - </view> |
24 | | - <view v-show="!disabled && (singleVal || (range.startDate && range.endDate))" class="uni-date__icon-clear" |
25 | | - @click="clear"> |
26 | | - <uni-icons type="clear" color="#e1e1e1" size="14"></uni-icons> |
27 | | - </view> |
| 31 | + </slot> |
28 | 32 | </view> |
29 | 33 |
|
30 | 34 | <view v-show="popup" class="uni-date-mask" @click="close"></view> |
|
101 | 105 | * @tutorial https://ext.dcloud.net.cn/plugin?id=3962 |
102 | 106 | * @property {String} type 选择器类型 |
103 | 107 | * @property {String|Array} value 绑定值 |
104 | | - * @property {String} placeholder 单选择时的占位内容 |
| 108 | + * @property {String} placeholder 单选择时的占位内容 |
105 | 109 | * @property {String} start 起始时间 |
106 | 110 | * @property {String} start 终止时间 |
107 | 111 | * @property {String} start-placeholder 范围选择时开始日期的占位内容 |
|
113 | 117 | **/ |
114 | 118 |
|
115 | 119 | export default { |
116 | | - name:'UniDatetimePicker', |
| 120 | + name: 'UniDatetimePicker', |
117 | 121 | components: { |
118 | 122 | calendar, |
119 | 123 | timePicker |
|
618 | 622 |
|
619 | 623 | <style> |
620 | 624 | .uni-date-x { |
621 | | - display: flex; |
| 625 | + display: flex; |
622 | 626 | flex-direction: row; |
623 | 627 | align-items: center; |
624 | 628 | justify-content: center; |
|
820 | 824 | .mr-50 { |
821 | 825 | margin-right: 50px; |
822 | 826 | } |
823 | | -
|
824 | | -</style> |
| 827 | +</style> |
0 commit comments