@kengic/uni 0.3.2-beta.10

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (166) hide show
  1. package/README.md +1 -0
  2. package/dist/index.css +1 -0
  3. package/dist/kengic-uni.js +5 -0
  4. package/dist/src/consts/i18n/en.d.ts +45 -0
  5. package/dist/src/consts/i18n/index.d.ts +90 -0
  6. package/dist/src/consts/i18n/zh_CN.d.ts +45 -0
  7. package/dist/src/consts/index.d.ts +1 -0
  8. package/dist/src/index.d.ts +2 -0
  9. package/dist/src/utils/index.d.ts +1 -0
  10. package/dist/src/utils/kg.util.d.ts +5 -0
  11. package/dist/uni-ui/index.ts +11 -0
  12. package/dist/uni-ui/uni-badge/uni-badge.vue +253 -0
  13. package/dist/uni-ui/uni-breadcrumb/uni-breadcrumb.vue +41 -0
  14. package/dist/uni-ui/uni-breadcrumb-item/uni-breadcrumb-item.vue +121 -0
  15. package/dist/uni-ui/uni-calendar/calendar.js +546 -0
  16. package/dist/uni-ui/uni-calendar/i18n/en.json +12 -0
  17. package/dist/uni-ui/uni-calendar/i18n/index.js +8 -0
  18. package/dist/uni-ui/uni-calendar/i18n/zh-Hans.json +12 -0
  19. package/dist/uni-ui/uni-calendar/i18n/zh-Hant.json +12 -0
  20. package/dist/uni-ui/uni-calendar/uni-calendar-item.vue +187 -0
  21. package/dist/uni-ui/uni-calendar/uni-calendar.vue +566 -0
  22. package/dist/uni-ui/uni-calendar/util.js +360 -0
  23. package/dist/uni-ui/uni-card/uni-card.vue +281 -0
  24. package/dist/uni-ui/uni-col/uni-col.vue +317 -0
  25. package/dist/uni-ui/uni-collapse/uni-collapse.vue +147 -0
  26. package/dist/uni-ui/uni-collapse-item/uni-collapse-item.vue +402 -0
  27. package/dist/uni-ui/uni-combox/uni-combox.vue +294 -0
  28. package/dist/uni-ui/uni-countdown/i18n/en.json +6 -0
  29. package/dist/uni-ui/uni-countdown/i18n/index.js +8 -0
  30. package/dist/uni-ui/uni-countdown/i18n/zh-Hans.json +6 -0
  31. package/dist/uni-ui/uni-countdown/i18n/zh-Hant.json +6 -0
  32. package/dist/uni-ui/uni-countdown/uni-countdown.vue +267 -0
  33. package/dist/uni-ui/uni-data-checkbox/uni-data-checkbox.vue +821 -0
  34. package/dist/uni-ui/uni-data-picker/keypress.js +45 -0
  35. package/dist/uni-ui/uni-data-picker/uni-data-picker.vue +551 -0
  36. package/dist/uni-ui/uni-data-pickerview/uni-data-picker.js +622 -0
  37. package/dist/uni-ui/uni-data-pickerview/uni-data-pickerview.vue +323 -0
  38. package/dist/uni-ui/uni-data-select/uni-data-select.vue +517 -0
  39. package/dist/uni-ui/uni-dateformat/date-format.js +200 -0
  40. package/dist/uni-ui/uni-dateformat/uni-dateformat.vue +88 -0
  41. package/dist/uni-ui/uni-datetime-picker/calendar-item.vue +177 -0
  42. package/dist/uni-ui/uni-datetime-picker/calendar.vue +928 -0
  43. package/dist/uni-ui/uni-datetime-picker/i18n/en.json +22 -0
  44. package/dist/uni-ui/uni-datetime-picker/i18n/index.js +8 -0
  45. package/dist/uni-ui/uni-datetime-picker/i18n/zh-Hans.json +22 -0
  46. package/dist/uni-ui/uni-datetime-picker/i18n/zh-Hant.json +22 -0
  47. package/dist/uni-ui/uni-datetime-picker/time-picker.vue +934 -0
  48. package/dist/uni-ui/uni-datetime-picker/uni-datetime-picker.vue +1026 -0
  49. package/dist/uni-ui/uni-datetime-picker/util.js +403 -0
  50. package/dist/uni-ui/uni-drawer/keypress.js +45 -0
  51. package/dist/uni-ui/uni-drawer/uni-drawer.vue +181 -0
  52. package/dist/uni-ui/uni-easyinput/common.js +56 -0
  53. package/dist/uni-ui/uni-easyinput/uni-easyinput.vue +660 -0
  54. package/dist/uni-ui/uni-fab/uni-fab.vue +491 -0
  55. package/dist/uni-ui/uni-fav/i18n/en.json +4 -0
  56. package/dist/uni-ui/uni-fav/i18n/index.js +8 -0
  57. package/dist/uni-ui/uni-fav/i18n/zh-Hans.json +4 -0
  58. package/dist/uni-ui/uni-fav/i18n/zh-Hant.json +4 -0
  59. package/dist/uni-ui/uni-fav/uni-fav.vue +161 -0
  60. package/dist/uni-ui/uni-file-picker/choose-and-upload-file.js +224 -0
  61. package/dist/uni-ui/uni-file-picker/uni-file-picker.vue +667 -0
  62. package/dist/uni-ui/uni-file-picker/upload-file.vue +325 -0
  63. package/dist/uni-ui/uni-file-picker/upload-image.vue +292 -0
  64. package/dist/uni-ui/uni-file-picker/utils.js +109 -0
  65. package/dist/uni-ui/uni-forms/uni-forms.vue +398 -0
  66. package/dist/uni-ui/uni-forms/utils.js +293 -0
  67. package/dist/uni-ui/uni-forms/validate.js +486 -0
  68. package/dist/uni-ui/uni-forms-item/uni-forms-item.vue +601 -0
  69. package/dist/uni-ui/uni-goods-nav/i18n/en.json +6 -0
  70. package/dist/uni-ui/uni-goods-nav/i18n/index.js +8 -0
  71. package/dist/uni-ui/uni-goods-nav/i18n/zh-Hans.json +6 -0
  72. package/dist/uni-ui/uni-goods-nav/i18n/zh-Hant.json +6 -0
  73. package/dist/uni-ui/uni-goods-nav/uni-goods-nav.vue +229 -0
  74. package/dist/uni-ui/uni-grid/uni-grid.vue +143 -0
  75. package/dist/uni-ui/uni-grid-item/uni-grid-item.vue +129 -0
  76. package/dist/uni-ui/uni-group/uni-group.vue +134 -0
  77. package/dist/uni-ui/uni-icons/icons.js +1169 -0
  78. package/dist/uni-ui/uni-icons/uni-icons.vue +96 -0
  79. package/dist/uni-ui/uni-icons/uniicons.css +663 -0
  80. package/dist/uni-ui/uni-icons/uniicons.ttf +0 -0
  81. package/dist/uni-ui/uni-indexed-list/uni-indexed-list-item.vue +144 -0
  82. package/dist/uni-ui/uni-indexed-list/uni-indexed-list.vue +367 -0
  83. package/dist/uni-ui/uni-link/uni-link.vue +128 -0
  84. package/dist/uni-ui/uni-list/uni-list.vue +123 -0
  85. package/dist/uni-ui/uni-list/uni-refresh.vue +65 -0
  86. package/dist/uni-ui/uni-list/uni-refresh.wxs +87 -0
  87. package/dist/uni-ui/uni-list-ad/uni-list-ad.vue +107 -0
  88. package/dist/uni-ui/uni-list-chat/uni-list-chat.scss +58 -0
  89. package/dist/uni-ui/uni-list-chat/uni-list-chat.vue +593 -0
  90. package/dist/uni-ui/uni-list-item/uni-list-item.vue +534 -0
  91. package/dist/uni-ui/uni-load-more/i18n/en.json +5 -0
  92. package/dist/uni-ui/uni-load-more/i18n/index.js +8 -0
  93. package/dist/uni-ui/uni-load-more/i18n/zh-Hans.json +5 -0
  94. package/dist/uni-ui/uni-load-more/i18n/zh-Hant.json +5 -0
  95. package/dist/uni-ui/uni-load-more/uni-load-more.vue +399 -0
  96. package/dist/uni-ui/uni-nav-bar/uni-nav-bar.vue +357 -0
  97. package/dist/uni-ui/uni-nav-bar/uni-status-bar.vue +24 -0
  98. package/dist/uni-ui/uni-notice-bar/uni-notice-bar.vue +426 -0
  99. package/dist/uni-ui/uni-number-box/uni-number-box.vue +221 -0
  100. package/dist/uni-ui/uni-pagination/i18n/en.json +5 -0
  101. package/dist/uni-ui/uni-pagination/i18n/es.json +5 -0
  102. package/dist/uni-ui/uni-pagination/i18n/fr.json +5 -0
  103. package/dist/uni-ui/uni-pagination/i18n/index.js +12 -0
  104. package/dist/uni-ui/uni-pagination/i18n/zh-Hans.json +5 -0
  105. package/dist/uni-ui/uni-pagination/i18n/zh-Hant.json +5 -0
  106. package/dist/uni-ui/uni-pagination/uni-pagination.vue +465 -0
  107. package/dist/uni-ui/uni-popup/i18n/en.json +7 -0
  108. package/dist/uni-ui/uni-popup/i18n/index.js +9 -0
  109. package/dist/uni-ui/uni-popup/i18n/zh-Hans.json +7 -0
  110. package/dist/uni-ui/uni-popup/i18n/zh-Hant.json +7 -0
  111. package/dist/uni-ui/uni-popup/keypress.js +45 -0
  112. package/dist/uni-ui/uni-popup/popup.js +23 -0
  113. package/dist/uni-ui/uni-popup/uni-popup.vue +464 -0
  114. package/dist/uni-ui/uni-popup-dialog/keypress.js +45 -0
  115. package/dist/uni-ui/uni-popup-dialog/uni-popup-dialog.vue +275 -0
  116. package/dist/uni-ui/uni-popup-message/uni-popup-message.vue +143 -0
  117. package/dist/uni-ui/uni-popup-share/uni-popup-share.vue +187 -0
  118. package/dist/uni-ui/uni-rate/uni-rate.vue +365 -0
  119. package/dist/uni-ui/uni-row/uni-row.vue +190 -0
  120. package/dist/uni-ui/uni-scss/changelog.md +8 -0
  121. package/dist/uni-ui/uni-scss/index.scss +1 -0
  122. package/dist/uni-ui/uni-scss/package.json +82 -0
  123. package/dist/uni-ui/uni-scss/readme.md +4 -0
  124. package/dist/uni-ui/uni-scss/styles/index.scss +7 -0
  125. package/dist/uni-ui/uni-scss/styles/setting/_border.scss +3 -0
  126. package/dist/uni-ui/uni-scss/styles/setting/_color.scss +66 -0
  127. package/dist/uni-ui/uni-scss/styles/setting/_radius.scss +55 -0
  128. package/dist/uni-ui/uni-scss/styles/setting/_space.scss +56 -0
  129. package/dist/uni-ui/uni-scss/styles/setting/_styles.scss +167 -0
  130. package/dist/uni-ui/uni-scss/styles/setting/_text.scss +24 -0
  131. package/dist/uni-ui/uni-scss/styles/setting/_variables.scss +146 -0
  132. package/dist/uni-ui/uni-scss/styles/tools/functions.scss +19 -0
  133. package/dist/uni-ui/uni-scss/theme.scss +31 -0
  134. package/dist/uni-ui/uni-scss/variables.scss +62 -0
  135. package/dist/uni-ui/uni-search-bar/i18n/en.json +4 -0
  136. package/dist/uni-ui/uni-search-bar/i18n/index.js +8 -0
  137. package/dist/uni-ui/uni-search-bar/i18n/zh-Hans.json +4 -0
  138. package/dist/uni-ui/uni-search-bar/i18n/zh-Hant.json +4 -0
  139. package/dist/uni-ui/uni-search-bar/uni-search-bar.vue +298 -0
  140. package/dist/uni-ui/uni-section/uni-section.vue +167 -0
  141. package/dist/uni-ui/uni-segmented-control/uni-segmented-control.vue +145 -0
  142. package/dist/uni-ui/uni-steps/uni-steps.vue +269 -0
  143. package/dist/uni-ui/uni-swipe-action/uni-swipe-action.vue +60 -0
  144. package/dist/uni-ui/uni-swipe-action-item/bindingx.js +302 -0
  145. package/dist/uni-ui/uni-swipe-action-item/isPC.js +12 -0
  146. package/dist/uni-ui/uni-swipe-action-item/mpalipay.js +195 -0
  147. package/dist/uni-ui/uni-swipe-action-item/mpother.js +260 -0
  148. package/dist/uni-ui/uni-swipe-action-item/mpwxs.js +84 -0
  149. package/dist/uni-ui/uni-swipe-action-item/render.js +270 -0
  150. package/dist/uni-ui/uni-swipe-action-item/uni-swipe-action-item.vue +347 -0
  151. package/dist/uni-ui/uni-swipe-action-item/wx.wxs +341 -0
  152. package/dist/uni-ui/uni-swiper-dot/uni-swiper-dot.vue +218 -0
  153. package/dist/uni-ui/uni-table/uni-table.vue +455 -0
  154. package/dist/uni-ui/uni-tag/uni-tag.vue +252 -0
  155. package/dist/uni-ui/uni-tbody/uni-tbody.vue +29 -0
  156. package/dist/uni-ui/uni-td/uni-td.vue +90 -0
  157. package/dist/uni-ui/uni-th/filter-dropdown.vue +511 -0
  158. package/dist/uni-ui/uni-th/uni-th.vue +285 -0
  159. package/dist/uni-ui/uni-thead/uni-thead.vue +129 -0
  160. package/dist/uni-ui/uni-title/uni-title.vue +171 -0
  161. package/dist/uni-ui/uni-tooltip/uni-tooltip.vue +68 -0
  162. package/dist/uni-ui/uni-tr/table-checkbox.vue +179 -0
  163. package/dist/uni-ui/uni-tr/uni-tr.vue +171 -0
  164. package/dist/uni-ui/uni-transition/createAnimation.js +131 -0
  165. package/dist/uni-ui/uni-transition/uni-transition.vue +281 -0
  166. package/package.json +90 -0
@@ -0,0 +1,566 @@
1
+ <template>
2
+ <view class="uni-calendar">
3
+ <view v-if="!insert&&show" class="uni-calendar__mask" :class="{'uni-calendar--mask-show':aniMaskShow}" @click="clean"></view>
4
+ <view v-if="insert || show" class="uni-calendar__content" :class="{'uni-calendar--fixed':!insert,'uni-calendar--ani-show':aniMaskShow}">
5
+ <view v-if="!insert" class="uni-calendar__header uni-calendar--fixed-top">
6
+ <view class="uni-calendar__header-btn-box" @click="close">
7
+ <text class="uni-calendar__header-text uni-calendar--fixed-width">{{cancelText}}</text>
8
+ </view>
9
+ <view class="uni-calendar__header-btn-box" @click="confirm">
10
+ <text class="uni-calendar__header-text uni-calendar--fixed-width">{{okText}}</text>
11
+ </view>
12
+ </view>
13
+ <view class="uni-calendar__header">
14
+ <view class="uni-calendar__header-btn-box" @click.stop="pre">
15
+ <view class="uni-calendar__header-btn uni-calendar--left"></view>
16
+ </view>
17
+ <picker mode="date" :value="date" fields="month" @change="bindDateChange">
18
+ <text class="uni-calendar__header-text">{{ (nowDate.year||'') +' / '+( nowDate.month||'')}}</text>
19
+ </picker>
20
+ <view class="uni-calendar__header-btn-box" @click.stop="next">
21
+ <view class="uni-calendar__header-btn uni-calendar--right"></view>
22
+ </view>
23
+ <text class="uni-calendar__backtoday" @click="backToday">{{todayText}}</text>
24
+
25
+ </view>
26
+ <view class="uni-calendar__box">
27
+ <view v-if="showMonth" class="uni-calendar__box-bg">
28
+ <text class="uni-calendar__box-bg-text">{{nowDate.month}}</text>
29
+ </view>
30
+ <view class="uni-calendar__weeks">
31
+ <view class="uni-calendar__weeks-day">
32
+ <text class="uni-calendar__weeks-day-text">{{SUNText}}</text>
33
+ </view>
34
+ <view class="uni-calendar__weeks-day">
35
+ <text class="uni-calendar__weeks-day-text">{{monText}}</text>
36
+ </view>
37
+ <view class="uni-calendar__weeks-day">
38
+ <text class="uni-calendar__weeks-day-text">{{TUEText}}</text>
39
+ </view>
40
+ <view class="uni-calendar__weeks-day">
41
+ <text class="uni-calendar__weeks-day-text">{{WEDText}}</text>
42
+ </view>
43
+ <view class="uni-calendar__weeks-day">
44
+ <text class="uni-calendar__weeks-day-text">{{THUText}}</text>
45
+ </view>
46
+ <view class="uni-calendar__weeks-day">
47
+ <text class="uni-calendar__weeks-day-text">{{FRIText}}</text>
48
+ </view>
49
+ <view class="uni-calendar__weeks-day">
50
+ <text class="uni-calendar__weeks-day-text">{{SATText}}</text>
51
+ </view>
52
+ </view>
53
+ <view class="uni-calendar__weeks" v-for="(item,weekIndex) in weeks" :key="weekIndex">
54
+ <view class="uni-calendar__weeks-item" v-for="(weeks,weeksIndex) in item" :key="weeksIndex">
55
+ <calendar-item class="uni-calendar-item--hook" :weeks="weeks" :calendar="calendar" :selected="selected" :lunar="lunar" @change="choiceDate"></calendar-item>
56
+ </view>
57
+ </view>
58
+ </view>
59
+ </view>
60
+ </view>
61
+ </template>
62
+
63
+ <script>
64
+ import Calendar from './util.js';
65
+ import CalendarItem from './uni-calendar-item.vue'
66
+
67
+ import { initVueI18n } from '@dcloudio/uni-i18n'
68
+ import i18nMessages from './i18n'
69
+ const { t } = initVueI18n(i18nMessages)
70
+
71
+ /**
72
+ * Calendar 日历
73
+ * @description 日历组件可以查看日期,选择任意范围内的日期,打点操作。常用场景如:酒店日期预订、火车机票选择购买日期、上下班打卡等
74
+ * @tutorial https://ext.dcloud.net.cn/plugin?id=56
75
+ * @property {String} date 自定义当前时间,默认为今天
76
+ * @property {Boolean} lunar 显示农历
77
+ * @property {String} startDate 日期选择范围-开始日期
78
+ * @property {String} endDate 日期选择范围-结束日期
79
+ * @property {Boolean} range 范围选择
80
+ * @property {Boolean} insert = [true|false] 插入模式,默认为false
81
+ * @value true 弹窗模式
82
+ * @value false 插入模式
83
+ * @property {Boolean} clearDate = [true|false] 弹窗模式是否清空上次选择内容
84
+ * @property {Array} selected 打点,期待格式[{date: '2019-06-27', info: '签到', data: { custom: '自定义信息', name: '自定义消息头',xxx:xxx... }}]
85
+ * @property {Boolean} showMonth 是否选择月份为背景
86
+ * @event {Function} change 日期改变,`insert :ture` 时生效
87
+ * @event {Function} confirm 确认选择`insert :false` 时生效
88
+ * @event {Function} monthSwitch 切换月份时触发
89
+ * @example <uni-calendar :insert="true":lunar="true" :start-date="'2019-3-2'":end-date="'2019-5-20'"@change="change" />
90
+ */
91
+ export default {
92
+ components: {
93
+ CalendarItem
94
+ },
95
+ emits:['close','confirm','change','monthSwitch'],
96
+ props: {
97
+ date: {
98
+ type: String,
99
+ default: ''
100
+ },
101
+ selected: {
102
+ type: Array,
103
+ default () {
104
+ return []
105
+ }
106
+ },
107
+ lunar: {
108
+ type: Boolean,
109
+ default: false
110
+ },
111
+ startDate: {
112
+ type: String,
113
+ default: ''
114
+ },
115
+ endDate: {
116
+ type: String,
117
+ default: ''
118
+ },
119
+ range: {
120
+ type: Boolean,
121
+ default: false
122
+ },
123
+ insert: {
124
+ type: Boolean,
125
+ default: true
126
+ },
127
+ showMonth: {
128
+ type: Boolean,
129
+ default: true
130
+ },
131
+ clearDate: {
132
+ type: Boolean,
133
+ default: true
134
+ }
135
+ },
136
+ data() {
137
+ return {
138
+ show: false,
139
+ weeks: [],
140
+ calendar: {},
141
+ nowDate: '',
142
+ aniMaskShow: false
143
+ }
144
+ },
145
+ computed:{
146
+ /**
147
+ * for i18n
148
+ */
149
+
150
+ okText() {
151
+ return t("uni-calender.ok")
152
+ },
153
+ cancelText() {
154
+ return t("uni-calender.cancel")
155
+ },
156
+ todayText() {
157
+ return t("uni-calender.today")
158
+ },
159
+ monText() {
160
+ return t("uni-calender.MON")
161
+ },
162
+ TUEText() {
163
+ return t("uni-calender.TUE")
164
+ },
165
+ WEDText() {
166
+ return t("uni-calender.WED")
167
+ },
168
+ THUText() {
169
+ return t("uni-calender.THU")
170
+ },
171
+ FRIText() {
172
+ return t("uni-calender.FRI")
173
+ },
174
+ SATText() {
175
+ return t("uni-calender.SAT")
176
+ },
177
+ SUNText() {
178
+ return t("uni-calender.SUN")
179
+ },
180
+ },
181
+ watch: {
182
+ date(newVal) {
183
+ // this.cale.setDate(newVal)
184
+ this.init(newVal)
185
+ },
186
+ startDate(val){
187
+ this.cale.resetSatrtDate(val)
188
+ this.cale.setDate(this.nowDate.fullDate)
189
+ this.weeks = this.cale.weeks
190
+ },
191
+ endDate(val){
192
+ this.cale.resetEndDate(val)
193
+ this.cale.setDate(this.nowDate.fullDate)
194
+ this.weeks = this.cale.weeks
195
+ },
196
+ selected(newVal) {
197
+ this.cale.setSelectInfo(this.nowDate.fullDate, newVal)
198
+ this.weeks = this.cale.weeks
199
+ }
200
+ },
201
+ created() {
202
+ this.cale = new Calendar({
203
+ selected: this.selected,
204
+ startDate: this.startDate,
205
+ endDate: this.endDate,
206
+ range: this.range,
207
+ })
208
+ this.init(this.date)
209
+ },
210
+ methods: {
211
+ // 取消穿透
212
+ clean() {},
213
+ bindDateChange(e) {
214
+ const value = e.detail.value + '-1'
215
+ this.setDate(value)
216
+
217
+ const { year,month } = this.cale.getDate(value)
218
+ this.$emit('monthSwitch', {
219
+ year,
220
+ month
221
+ })
222
+ },
223
+ /**
224
+ * 初始化日期显示
225
+ * @param {Object} date
226
+ */
227
+ init(date) {
228
+ this.cale.setDate(date)
229
+ this.weeks = this.cale.weeks
230
+ this.nowDate = this.calendar = this.cale.getInfo(date)
231
+ },
232
+ /**
233
+ * 打开日历弹窗
234
+ */
235
+ open() {
236
+ // 弹窗模式并且清理数据
237
+ if (this.clearDate && !this.insert) {
238
+ this.cale.cleanMultipleStatus()
239
+ // this.cale.setDate(this.date)
240
+ this.init(this.date)
241
+ }
242
+ this.show = true
243
+ this.$nextTick(() => {
244
+ setTimeout(() => {
245
+ this.aniMaskShow = true
246
+ }, 50)
247
+ })
248
+ },
249
+ /**
250
+ * 关闭日历弹窗
251
+ */
252
+ close() {
253
+ this.aniMaskShow = false
254
+ this.$nextTick(() => {
255
+ setTimeout(() => {
256
+ this.show = false
257
+ this.$emit('close')
258
+ }, 300)
259
+ })
260
+ },
261
+ /**
262
+ * 确认按钮
263
+ */
264
+ confirm() {
265
+ this.setEmit('confirm')
266
+ this.close()
267
+ },
268
+ /**
269
+ * 变化触发
270
+ */
271
+ change() {
272
+ if (!this.insert) return
273
+ this.setEmit('change')
274
+ },
275
+ /**
276
+ * 选择月份触发
277
+ */
278
+ monthSwitch() {
279
+ let {
280
+ year,
281
+ month
282
+ } = this.nowDate
283
+ this.$emit('monthSwitch', {
284
+ year,
285
+ month: Number(month)
286
+ })
287
+ },
288
+ /**
289
+ * 派发事件
290
+ * @param {Object} name
291
+ */
292
+ setEmit(name) {
293
+ let {
294
+ year,
295
+ month,
296
+ date,
297
+ fullDate,
298
+ lunar,
299
+ extraInfo
300
+ } = this.calendar
301
+ this.$emit(name, {
302
+ range: this.cale.multipleStatus,
303
+ year,
304
+ month,
305
+ date,
306
+ fulldate: fullDate,
307
+ lunar,
308
+ extraInfo: extraInfo || {}
309
+ })
310
+ },
311
+ /**
312
+ * 选择天触发
313
+ * @param {Object} weeks
314
+ */
315
+ choiceDate(weeks) {
316
+ if (weeks.disable) return
317
+ this.calendar = weeks
318
+ // 设置多选
319
+ this.cale.setMultiple(this.calendar.fullDate)
320
+ this.weeks = this.cale.weeks
321
+ this.change()
322
+ },
323
+ /**
324
+ * 回到今天
325
+ */
326
+ backToday() {
327
+ const nowYearMonth = `${this.nowDate.year}-${this.nowDate.month}`
328
+ const date = this.cale.getDate(new Date())
329
+ const todayYearMonth = `${date.year}-${date.month}`
330
+
331
+ if(nowYearMonth !== todayYearMonth) {
332
+ this.monthSwitch()
333
+ }
334
+
335
+ this.init(date.fullDate)
336
+ this.change()
337
+ },
338
+ /**
339
+ * 上个月
340
+ */
341
+ pre() {
342
+ const preDate = this.cale.getDate(this.nowDate.fullDate, -1, 'month').fullDate
343
+ this.setDate(preDate)
344
+ this.monthSwitch()
345
+
346
+ },
347
+ /**
348
+ * 下个月
349
+ */
350
+ next() {
351
+ const nextDate = this.cale.getDate(this.nowDate.fullDate, +1, 'month').fullDate
352
+ this.setDate(nextDate)
353
+ this.monthSwitch()
354
+ },
355
+ /**
356
+ * 设置日期
357
+ * @param {Object} date
358
+ */
359
+ setDate(date) {
360
+ this.cale.setDate(date)
361
+ this.weeks = this.cale.weeks
362
+ this.nowDate = this.cale.getInfo(date)
363
+ }
364
+ }
365
+ }
366
+ </script>
367
+
368
+ <style lang="scss" scoped>
369
+ $uni-bg-color-mask: rgba($color: #000000, $alpha: 0.4);
370
+ $uni-border-color: #EDEDED;
371
+ $uni-text-color: #333;
372
+ $uni-bg-color-hover:#f1f1f1;
373
+ $uni-font-size-base:14px;
374
+ $uni-text-color-placeholder: #808080;
375
+ $uni-color-subtitle: #555555;
376
+ $uni-text-color-grey:#999;
377
+ .uni-calendar {
378
+ /* #ifndef APP-NVUE */
379
+ display: flex;
380
+ /* #endif */
381
+ flex-direction: column;
382
+ }
383
+
384
+ .uni-calendar__mask {
385
+ position: fixed;
386
+ bottom: 0;
387
+ top: 0;
388
+ left: 0;
389
+ right: 0;
390
+ background-color: $uni-bg-color-mask;
391
+ transition-property: opacity;
392
+ transition-duration: 0.3s;
393
+ opacity: 0;
394
+ /* #ifndef APP-NVUE */
395
+ z-index: 99;
396
+ /* #endif */
397
+ }
398
+
399
+ .uni-calendar--mask-show {
400
+ opacity: 1
401
+ }
402
+
403
+ .uni-calendar--fixed {
404
+ position: fixed;
405
+ /* #ifdef APP-NVUE */
406
+ bottom: 0;
407
+ /* #endif */
408
+ left: 0;
409
+ right: 0;
410
+ transition-property: transform;
411
+ transition-duration: 0.3s;
412
+ transform: translateY(460px);
413
+ /* #ifndef APP-NVUE */
414
+ bottom: calc(var(--window-bottom));
415
+ z-index: 99;
416
+ /* #endif */
417
+ }
418
+
419
+ .uni-calendar--ani-show {
420
+ transform: translateY(0);
421
+ }
422
+
423
+ .uni-calendar__content {
424
+ background-color: #fff;
425
+ }
426
+
427
+ .uni-calendar__header {
428
+ position: relative;
429
+ /* #ifndef APP-NVUE */
430
+ display: flex;
431
+ /* #endif */
432
+ flex-direction: row;
433
+ justify-content: center;
434
+ align-items: center;
435
+ height: 50px;
436
+ border-bottom-color: $uni-border-color;
437
+ border-bottom-style: solid;
438
+ border-bottom-width: 1px;
439
+ }
440
+
441
+ .uni-calendar--fixed-top {
442
+ /* #ifndef APP-NVUE */
443
+ display: flex;
444
+ /* #endif */
445
+ flex-direction: row;
446
+ justify-content: space-between;
447
+ border-top-color: $uni-border-color;
448
+ border-top-style: solid;
449
+ border-top-width: 1px;
450
+ }
451
+
452
+ .uni-calendar--fixed-width {
453
+ width: 50px;
454
+ }
455
+
456
+ .uni-calendar__backtoday {
457
+ position: absolute;
458
+ right: 0;
459
+ top: 25rpx;
460
+ padding: 0 5px;
461
+ padding-left: 10px;
462
+ height: 25px;
463
+ line-height: 25px;
464
+ font-size: 12px;
465
+ border-top-left-radius: 25px;
466
+ border-bottom-left-radius: 25px;
467
+ color: $uni-text-color;
468
+ background-color: $uni-bg-color-hover;
469
+ }
470
+
471
+ .uni-calendar__header-text {
472
+ text-align: center;
473
+ width: 100px;
474
+ font-size: $uni-font-size-base;
475
+ color: $uni-text-color;
476
+ }
477
+
478
+ .uni-calendar__header-btn-box {
479
+ /* #ifndef APP-NVUE */
480
+ display: flex;
481
+ /* #endif */
482
+ flex-direction: row;
483
+ align-items: center;
484
+ justify-content: center;
485
+ width: 50px;
486
+ height: 50px;
487
+ }
488
+
489
+ .uni-calendar__header-btn {
490
+ width: 10px;
491
+ height: 10px;
492
+ border-left-color: $uni-text-color-placeholder;
493
+ border-left-style: solid;
494
+ border-left-width: 2px;
495
+ border-top-color: $uni-color-subtitle;
496
+ border-top-style: solid;
497
+ border-top-width: 2px;
498
+ }
499
+
500
+ .uni-calendar--left {
501
+ transform: rotate(-45deg);
502
+ }
503
+
504
+ .uni-calendar--right {
505
+ transform: rotate(135deg);
506
+ }
507
+
508
+
509
+ .uni-calendar__weeks {
510
+ position: relative;
511
+ /* #ifndef APP-NVUE */
512
+ display: flex;
513
+ /* #endif */
514
+ flex-direction: row;
515
+ }
516
+
517
+ .uni-calendar__weeks-item {
518
+ flex: 1;
519
+ }
520
+
521
+ .uni-calendar__weeks-day {
522
+ flex: 1;
523
+ /* #ifndef APP-NVUE */
524
+ display: flex;
525
+ /* #endif */
526
+ flex-direction: column;
527
+ justify-content: center;
528
+ align-items: center;
529
+ height: 45px;
530
+ border-bottom-color: #F5F5F5;
531
+ border-bottom-style: solid;
532
+ border-bottom-width: 1px;
533
+ }
534
+
535
+ .uni-calendar__weeks-day-text {
536
+ font-size: 14px;
537
+ }
538
+
539
+ .uni-calendar__box {
540
+ position: relative;
541
+ }
542
+
543
+ .uni-calendar__box-bg {
544
+ /* #ifndef APP-NVUE */
545
+ display: flex;
546
+ /* #endif */
547
+ justify-content: center;
548
+ align-items: center;
549
+ position: absolute;
550
+ top: 0;
551
+ left: 0;
552
+ right: 0;
553
+ bottom: 0;
554
+ }
555
+
556
+ .uni-calendar__box-bg-text {
557
+ font-size: 200px;
558
+ font-weight: bold;
559
+ color: $uni-text-color-grey;
560
+ opacity: 0.1;
561
+ text-align: center;
562
+ /* #ifndef APP-NVUE */
563
+ line-height: 1;
564
+ /* #endif */
565
+ }
566
+ </style>