|
4 | 4 | 'uni-date-x--border': border}"> |
5 | 5 | <view v-if="!isRange" class="uni-date-x uni-date-single" @click="show"> |
6 | 6 | <view class="uni-date__icon-logo"> |
7 | | - <image class="uni-date-editor--logo" src="./cale-50.png" mode=""></image> |
| 7 | + <image class="uni-date-editor--logo" :src="iconBase64" mode=""></image> |
8 | 8 | </view> |
9 | 9 | <input class="uni-date__input" type="text" v-model="singleVal" :placeholder="placeholder" |
10 | 10 | :disabled="true" /> |
11 | 11 | </view> |
12 | 12 | <view v-else class="uni-date-x uni-date-range" @click="show"> |
13 | 13 | <view class="uni-date__icon-logo"> |
14 | | - <image class="uni-date-editor--logo" src="./cale-50.png" mode=""></image> |
| 14 | + <image class="uni-date-editor--logo" :src="iconBase64" mode=""></image> |
15 | 15 | </view> |
16 | 16 | <input class="uni-date__input uni-date-range__input" type="text" v-model="range.startDate" |
17 | 17 | :placeholder="startPlaceholder" :disabled="true" /> |
|
28 | 28 | </view> |
29 | 29 |
|
30 | 30 | <view v-show="popup" class="uni-date-mask" @click="close"></view> |
31 | | - <view ref="datePicker" v-show="popup" class="uni-date-picker__container"> |
| 31 | + <view ref="datePicker" v-show="popup" class="uni-date-picker__container"> |
32 | 32 | <view v-if="!isRange" class="uni-date-single--x" :style="popover"> |
33 | 33 | <view v-show="hasTime" class="uni-date-changed popup-x-header"> |
34 | 34 | <input class="uni-date__input uni-date-range__input" type="text" v-model="tempSingleDate" |
|
39 | 39 | placeholder="选择时间" :disabled="!tempSingleDate" /> |
40 | 40 | </time-picker> |
41 | 41 | </view> |
42 | | - <uni-calendar ref="pcSingle" :showMonth="false" :start-date="caleRange.startDate" |
| 42 | + <calendar ref="pcSingle" :showMonth="false" :start-date="caleRange.startDate" |
43 | 43 | :end-date="caleRange.endDate" :date="defSingleDate" @change="singleChange" /> |
44 | 44 | <view v-if="hasTime" class="popup-x-footer"> |
45 | 45 | <!-- <text class="">此刻</text> --> |
46 | 46 | <text class="confirm" @click="confirmSingleChange">确定</text> |
47 | | - </view> |
| 47 | + </view> |
48 | 48 | <view class="uni-date-popper__arrow"></view> |
49 | 49 | </view> |
50 | 50 |
|
|
71 | 71 | </view> |
72 | 72 | </view> |
73 | 73 | <view class="popup-x-body"> |
74 | | - <uni-calendar ref="left" :showMonth="false" :start-date="caleRange.startDate" |
| 74 | + <calendar ref="left" :showMonth="false" :start-date="caleRange.startDate" |
75 | 75 | :end-date="caleRange.endDate" :range="true" @change="leftChange" :pleStatus="endMultipleStatus" |
76 | 76 | @firstEnterCale="updateRightCale" @monthSwitch="leftMonthSwitch" style="padding-right: 16px;" /> |
77 | | - <uni-calendar ref="right" :showMonth="false" :start-date="caleRange.startDate" |
| 77 | + <calendar ref="right" :showMonth="false" :start-date="caleRange.startDate" |
78 | 78 | :end-date="caleRange.endDate" :range="true" @change="rightChange" |
79 | 79 | :pleStatus="startMultipleStatus" @firstEnterCale="updateLeftCale" |
80 | 80 | @monthSwitch="rightMonthSwitch" style="padding-left: 16px;border-left: 1px solid #F1F1F1;" /> |
|
85 | 85 | </view> |
86 | 86 | </view> |
87 | 87 | </view> |
88 | | - <uni-calendar ref="mobile" :clearDate="false" :date="defSingleDate" :defTime="reactMobDefTime" |
| 88 | + <calendar ref="mobile" :clearDate="false" :date="defSingleDate" :defTime="reactMobDefTime" |
89 | 89 | :start-date="caleRange.startDate" :end-date="caleRange.endDate" :selectableTimes="mobSelectableTime" |
90 | 90 | :pleStatus="endMultipleStatus" :showMonth="false" :range="isRange" :typeHasTime="hasTime" :insert="false" |
91 | 91 | @confirm="mobileChange" /> |
92 | 92 | </view> |
93 | 93 | </template> |
94 | 94 | <script> |
95 | | - import uniCalendar from './uni-calendar.vue' |
| 95 | + import calendar from './calendar.vue' |
96 | 96 | import timePicker from './time-picker.vue' |
97 | 97 |
|
98 | 98 | /** |
|
110 | 110 | * @event {Function} change 确定日期时触发的事件 |
111 | 111 | **/ |
112 | 112 |
|
113 | | - export default { |
| 113 | + export default { |
114 | 114 | name:'UniDatetimePicker', |
115 | 115 | components: { |
116 | | - uniCalendar, |
| 116 | + calendar, |
117 | 117 | timePicker |
118 | 118 | }, |
119 | 119 | data() { |
|
160 | 160 | }, |
161 | 161 | visible: false, |
162 | 162 | popup: false, |
163 | | - popover: null |
| 163 | + popover: null, |
| 164 | + iconBase64: 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADIAAAAyCAYAAAAeP4ixAAAABmJLR0QA/wD/AP+gvaeTAAACVklEQVRoge2Zv2vTQRTAP4oWJQQskmolBAnSQVMcSxbp4ubmIEWETu0oIjg5iIOgpLNunfQfMHToUgpOVgfRqRAL4q8WRLQVq4sOdyHPL9/7evfNJReS+8DB433v7r37fl/eu9xBJBKUB0BLt+uDaOOQZb8SUNXyuKuRftg46NeXcBww6M8AC0ANOAycAyb1s7e6+SbNxi/gBfAQ2HadcA7YB/4MUPsKzLos4jzwewAcNy3mhMnx5I/9BiqUAD4DDWAXmAfqWt8Enlq+GBfSbEwAt4AicAxYBO7aTPaGzhu4KvTLQn/Hh9cpmGzcFvqmaXAyaxWE/MGTg93yXsgFUyfbOrJCJ2s8y+tRP21s0fmMTlmih8zT8WnN1GloCmJWaF0CpvrlSAb1/3fJXshNT470hZEIrZeoahqaU8BZ10Exa4XGtiCaKKL+EIHaMX8U81ZEP7ntrwi7n4CfWi7p+UCFdFdh7Rpaps9+mn93rjY2THut0QqtoVlIkpi1QjNyCzEdnl0W+idCXxb6VmKudaGfsbBhRbcHdEWhf5eYt0o6FVR6BjhqYcOKoQkt2y/SAB5rWVbpVeCilmUl3hb6JNeAI1p+ZWEjFzH9hsY2tEwHdHX9DGATWNLyceCeGL/YhY+58LWhy9o0uhJDKw3T4dlr4L6WZab5JvRBGJqs9UPI5R44lQfpx56pUzK0NlA3R6AK1Engu1+/nGhfK7R5bjtwGnXdFfpSJ6190Quz5grqQCC048lFXMhy2nQZWkUVsRowZv8OvLOPCvdHwE5APyKRSMQzfwE22DtT3T5PPwAAAABJRU5ErkJggg==' |
164 | 165 | } |
165 | 166 | }, |
166 | 167 | props: { |
|
407 | 408 | } |
408 | 409 | this.$emit('change', value) |
409 | 410 | this.$emit('input', value) |
410 | | - }, |
411 | | - createTimestamp(date) { |
412 | | - date = this.fixIosDateFormat(date) |
413 | | - return Date.parse(new Date(date)) |
| 411 | + }, |
| 412 | + createTimestamp(date) { |
| 413 | + date = this.fixIosDateFormat(date) |
| 414 | + return Date.parse(new Date(date)) |
414 | 415 | }, |
415 | 416 | singleChange(e) { |
416 | 417 | this.tempSingleDate = e.fulldate |
|
574 | 575 | // if (this.popup) this.popup = false |
575 | 576 | }, |
576 | 577 |
|
577 | | - parseDate(date) { |
| 578 | + parseDate(date) { |
578 | 579 | date = this.fixIosDateFormat(date) |
579 | 580 | const defVal = new Date(date) |
580 | 581 | const year = defVal.getFullYear() |
|
595 | 596 | return item < 10 ? '0' + item : item |
596 | 597 | }, |
597 | 598 |
|
598 | | - //兼容 iOS、safari 日期格式 |
599 | | - fixIosDateFormat(value) { |
600 | | - if (typeof value === 'string') { |
601 | | - value = value.replace(/-/g, '/') |
602 | | - } |
603 | | - return value |
604 | | - }, |
| 599 | + //兼容 iOS、safari 日期格式 |
| 600 | + fixIosDateFormat(value) { |
| 601 | + if (typeof value === 'string') { |
| 602 | + value = value.replace(/-/g, '/') |
| 603 | + } |
| 604 | + return value |
| 605 | + }, |
605 | 606 |
|
606 | 607 | leftMonthSwitch(e) { |
607 | 608 | // console.log('leftMonthSwitch 返回:', e) |
|
687 | 688 | z-index: 996; |
688 | 689 | } |
689 | 690 |
|
690 | | - .uni-date-single--x { |
| 691 | + .uni-date-single--x { |
691 | 692 | /* padding: 0 8px; */ |
692 | 693 | position: absolute; |
693 | 694 | top: 0; |
|
699 | 700 | border-radius: 4px; |
700 | 701 | } |
701 | 702 |
|
702 | | - .uni-date-range--x { |
| 703 | + .uni-date-range--x { |
703 | 704 | padding: 0 8px; |
704 | 705 | background-color: #fff; |
705 | 706 | position: absolute; |
|
790 | 791 | .uni-date-changed--time-date { |
791 | 792 | color: #333; |
792 | 793 | opacity: 0.6; |
793 | | - } |
794 | | -
|
795 | | - /* .uni-date-popper__arrow { |
796 | | - width: 10px; |
797 | | - height: 10px; |
798 | | - top: -6px; |
799 | | - left: 35px; |
800 | | - margin-right: 3px; |
801 | | - border-top-width: 0; |
802 | | - border-bottom-color: #ebeef5; |
803 | | - border-width: 6px; |
804 | | - filter: drop-shadow(0 2px 12px rgba(0,0,0,.03)); |
805 | | - } |
806 | | - .uni-date-popper__arrow:after { |
807 | | - content: " "; |
808 | | - position: absolute; |
809 | | - display: block; |
810 | | - width: 0; |
811 | | - height: 0; |
812 | | - border-color: transparent; |
813 | | - border-style: solid; |
| 794 | + } |
| 795 | +
|
| 796 | + /* .uni-date-popper__arrow { |
| 797 | + width: 10px; |
| 798 | + height: 10px; |
| 799 | + top: -6px; |
| 800 | + left: 35px; |
| 801 | + margin-right: 3px; |
| 802 | + border-top-width: 0; |
| 803 | + border-bottom-color: #ebeef5; |
| 804 | + border-width: 6px; |
| 805 | + filter: drop-shadow(0 2px 12px rgba(0,0,0,.03)); |
| 806 | + } |
| 807 | + .uni-date-popper__arrow:after { |
| 808 | + content: " "; |
| 809 | + position: absolute; |
| 810 | + display: block; |
| 811 | + width: 0; |
| 812 | + height: 0; |
| 813 | + border-color: transparent; |
| 814 | + border-style: solid; |
814 | 815 | } */ |
815 | 816 |
|
816 | 817 | .mr-50 { |
817 | 818 | margin-right: 50px; |
818 | | - } |
| 819 | + } |
819 | 820 |
|
820 | | -</style> |
| 821 | +</style> |
0 commit comments