zydx-plus 1.0.6 → 1.0.7

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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "zydx-plus",
3
- "version": "1.0.6",
3
+ "version": "1.0.7",
4
4
  "description": "Vue.js",
5
5
  "main": "src/index.js",
6
6
  "files": [
@@ -0,0 +1,6 @@
1
+ import main from './src/Calendar';
2
+
3
+ main.install = function(Vue) {
4
+ Vue.component(main.name, main);
5
+ };
6
+ export default main;
@@ -0,0 +1,262 @@
1
+ .cale{
2
+ position: absolute;
3
+ top: 22px;
4
+ right: 0;
5
+ width: 300px;
6
+ height: 330px;
7
+ z-index: 100;
8
+ background-color: #fff;
9
+ box-shadow: 0 0 4px 1px #ccc;
10
+ border-radius: 5px;
11
+ padding: 0 10px;
12
+ display: grid;
13
+ user-select: none;
14
+ }
15
+ .cale-cont{
16
+ width: 100%;
17
+ height: 300px;
18
+ background-color: #fff;
19
+ border-radius: 10px;
20
+ }
21
+ .calendar-Time-header{
22
+ text-align: center;
23
+ vertical-align: middle;
24
+ padding: 10px 0;
25
+ font-size: 14px;
26
+ }
27
+ .month-txt{
28
+ padding: 26px 0 55px 0;
29
+ display: flex;
30
+ }
31
+ .calendar-lastY{
32
+ font-size: 12px;
33
+ cursor: pointer;
34
+ margin-right: 10px;
35
+ }
36
+ .calendar-nextY{
37
+ font-size: 12px;
38
+ cursor: pointer;
39
+ margin-left: 10px;
40
+ }
41
+ .month-txt-left{
42
+ flex: 1;
43
+ color: #4581FB;
44
+ font-size: 50px;
45
+ font-weight: bold;
46
+ }
47
+ .month-txt-right{
48
+ flex: 1;
49
+ text-align: right;
50
+ font-size: 55px;
51
+ color: #F4C256;
52
+ font-weight: bold;
53
+ }
54
+ .month-txt-right>text{
55
+ color: #4581FB;
56
+ }
57
+ .calendar-lastMonth{
58
+ width: 30px;
59
+ font-size: 12px;
60
+ margin-right: 20%;
61
+ padding: 0 5px;
62
+ text-align: center;
63
+ cursor: pointer;
64
+ }
65
+ .calendar-nextMonth{
66
+ width: 30px;
67
+ text-align: center;
68
+ margin-left: 20%;
69
+ font-size: 12px;
70
+ padding: 0 5px;
71
+ cursor: pointer;
72
+ }
73
+ .calendar-backToToday{
74
+ text-align: center;
75
+ font-size: 24px;
76
+ position: absolute;
77
+ right: 5px;
78
+ }
79
+
80
+ .calendar-row:before,
81
+ .calendar-row:after {
82
+ display: table;
83
+ content: ' ';
84
+ }
85
+
86
+ .calendar-row:after {
87
+ clear: both;
88
+ }
89
+
90
+ .calendar-col {
91
+ position: relative;
92
+ float: left;
93
+ white-space: nowrap;
94
+ text-overflow: ellipsis;
95
+ -o-text-overflow: ellipsis;
96
+ overflow: hidden;
97
+ font-size: 12px;
98
+ }
99
+ .cal-k{
100
+ width: 14.2%;
101
+ height: 37px;
102
+ padding: 2px 0;
103
+ transform:scale(.8);
104
+ cursor: pointer;
105
+ }
106
+ .aligncanter {
107
+ text-align: center;
108
+ }
109
+ .coll{
110
+ background-color: #4581FB;
111
+ height: 22px !important;
112
+ border-radius: 30px;
113
+ width: 14.2%;
114
+ line-height: 22px;
115
+ color: #fff;
116
+ transform:scale(.8);
117
+ }
118
+ .colh{
119
+ background-color: #F4C256;
120
+ height: 22px;
121
+ border-radius: 30px;
122
+ width: 14.2%;
123
+ line-height: 22px;
124
+ color: #fff;
125
+ transform:scale(.8);
126
+ }
127
+ .ma{
128
+ margin-right: 0 !important;
129
+ }
130
+
131
+ .calendar-header {
132
+ color: gray;
133
+ vertical-align: middle;
134
+ font-size: 12px;
135
+ padding: 5px 0;
136
+ }
137
+
138
+ .calendar-day {
139
+ height: 80px;
140
+ transform: translate3d(0px, 0px, 0px) translateZ(0px); transition-duration: 0ms; transition-timing-function: cubic-bezier(0.165, 0.84, 0.44, 1);
141
+ }
142
+
143
+
144
+ .calendar-content {
145
+ }
146
+
147
+ .calendar-date{
148
+ }
149
+ .calendar-today {
150
+ border-radius: 6px;
151
+ background-color: #43CD80;
152
+ color:white;
153
+ -moz-box-shadow: 0px 2px 10px #ABABAB;
154
+ -webkit-box-shadow: 0px 2px 10px #ABABAB;
155
+ box-shadow: 0px 2px 10px #ABABAB;
156
+ }
157
+ .calendar-today .calendar-point{
158
+ color: white !important;
159
+ }
160
+
161
+ .calendar-today .calendar-text{
162
+ color: white !important;
163
+ }
164
+
165
+ .calendar-col-lastMonth .calendar-text{
166
+ color: gray;
167
+ }
168
+
169
+ .calendar-col-nextMonth .calendar-text{
170
+ color: gray;
171
+ }
172
+
173
+ .calendar-today .calendar-date{
174
+ color: white !important;
175
+ }
176
+
177
+ .calendar-active {
178
+ color:#01AAED;
179
+ background-color: #D9D9D9;
180
+ -moz-box-shadow: 0px 2px 10px #ABABAB;
181
+ -webkit-box-shadow: 0px 2px 10px #ABABAB;
182
+ box-shadow: 0px 2px 10px #ABABAB;
183
+ }
184
+ /* 范围标记 */
185
+ .calendar-range {
186
+ /* color:#01AAED; */
187
+ border-radius: 0px;
188
+ background-color: #D9D9D9;
189
+ -moz-box-shadow: none;
190
+ -webkit-box-shadow: none;
191
+ box-shadow: none;
192
+ }
193
+
194
+
195
+
196
+ .ClearBoth {
197
+ clear: both;
198
+ }
199
+ .calendar-col-nextMonth{
200
+ color:gray;
201
+ }
202
+ .calendar-col-lastMonth{
203
+ color:gray;
204
+ }
205
+ .calendar-btn-disabled{
206
+ color:gainsboro;
207
+ }
208
+ .calendar-point{
209
+ font-size: 16px;color: #01AAED;top:2px;right: 2px;position: absolute;
210
+ }
211
+ .calendar-text{
212
+ padding: 4px 0;
213
+ width:100%;font-size: 20px;color: #01AAED;top:40px;left: 0px;position: absolute;overflow:hidden;
214
+ }
215
+ .dayValue{
216
+ text-align: center;
217
+ height: 34px;
218
+ box-sizing: border-box;
219
+ }
220
+
221
+ .calendar-day-6-7{
222
+ color: #4581FB;
223
+ }
224
+
225
+ /* 超出日期范围 */
226
+ .calendar-out-of-Date{
227
+ background-color: #EAEAEA;
228
+ }
229
+ .calendar-out-of-Date .calendar-date{
230
+ color: gray;
231
+ }
232
+
233
+
234
+
235
+
236
+
237
+ /* 以下为实现0.5px底部边界 */
238
+ .under_line{position: relative;}
239
+ .under_line:before,
240
+ .under_line:after{position: absolute;content: " ";height: 1px;width: 100%;left: 0;transform-origin: 0 0;-webkit-transform-origin: 0 0;}
241
+ /* .fineLine:before{顶部top: 0;background: #000;} */
242
+ .under_line:after{bottom: 0;border-bottom: 1px solid #ccc;}
243
+ @media only screen and (-webkit-min-device-pixel-ratio: 1.5){.under_line:after,.under_line:before{-webkit-transform: scaleY(.667);}}
244
+ @media only screen and (-webkit-min-device-pixel-ratio: 2){.under_line:after,.under_line:before{-webkit-transform: scaleY(.5);}}
245
+ /* 以上为实现0.5px底部边界 */
246
+ .cle-but-cont{
247
+ margin-top: 5px;
248
+ padding: 5px 0 0 0;
249
+ text-align: right;
250
+ border-top: 1px solid #ccc;
251
+ }
252
+ .cle-but{
253
+ margin-left: 5px;
254
+ font-size: 12px;
255
+ background-color: #fff;
256
+ border: 1px solid #000;
257
+ border-radius: 3px;
258
+ padding: 2px 5px;
259
+ cursor: pointer;
260
+ width: 50px;
261
+ text-align: center;
262
+ }
@@ -0,0 +1,699 @@
1
+ <template>
2
+ <div class="cale">
3
+ <div class="cale-cont">
4
+ <div class='calendar-Time-header under_line'>
5
+ <span class='calendar-lastY' @click="subYear">《</span>
6
+ <span class='calendar-lastMonth' @click="subMonth" :class="{'calendar-btn-disabled' : lastDisabled }">{{lastText}}</span>
7
+ <span class='calendar-TimeH'>{{title_time}}</span>
8
+ <span class='calendar-nextMonth' @click="addMonth" :class="{'calendar-btn-disabled' : nextDisabled }">{{nextText}}</span>
9
+ <span class='calendar-nextY' @click="addYear">》</span>
10
+ </div>
11
+ <div class="calendar-content">
12
+ <div class="calendar-row calendar-header">
13
+ <div class="calendar-col aligncanter coll">星期日</div>
14
+ <div class="calendar-col aligncanter colh">星期一</div>
15
+ <div class="calendar-col aligncanter colh">星期二</div>
16
+ <div class="calendar-col aligncanter colh">星期三</div>
17
+ <div class="calendar-col aligncanter colh">星期四</div>
18
+ <div class="calendar-col aligncanter colh">星期五</div>
19
+ <div class="calendar-col aligncanter coll ma">星期六</div>
20
+ </div>
21
+ <div class="calendar-row calendar-day"
22
+ :style="{'transform':transformObj, 'transition-duration':transformTimeObj}">
23
+ <div class="calendar-col aligncanter cal-k calendar-col-lastMonth" :style="{'line-height':(showLunar)?'auto':'37px'}" v-for='item in beforeDateList'
24
+ :key='item.key' @click="subMonth" :class="{'calendar-out-of-Date' : item.outOfDate }">
25
+ {{item.dateIndex}}
26
+ <p class='calendar-span'>{{item.markText}}</p>
27
+ </div>
28
+
29
+ <div class="calendar-col aligncanter cal-k currentDays" :style="{'line-height':(showLunar)?'auto':'37px'}" :class="{'calendar-active' : item.dateIndex == currentSelectTime
30
+ , 'calendar-today' : item.isToday
31
+ , 'calendar-range' : item.isRanges
32
+ , 'calendar-out-of-Date' : item.outOfDate }" v-for='item in dateList' v-bind:key='item.key'
33
+ @click="selectedDateFun(item.dateIndex)">
34
+ <div class='dayValue'>
35
+ <span class='calendar-date calendar-day-6-7'
36
+ v-if="item.isDaySunOrSat">{{item.dateIndex}}</span>
37
+ <span v-else class='calendar-date'>{{item.dateIndex}}</span>
38
+ <span class='calendar-point'
39
+ :style="{'color':item.pointTextColor?item.pointTextColor:maskColor}">{{item.pointText}}</span>
40
+ <p class='calendar-span'
41
+ :style="{'color':item.markTextColor?item.markTextColor:maskColor}">{{item.markText}}</p>
42
+ </div>
43
+ </div>
44
+
45
+ <div class="calendar-col cal-k aligncanter calendar-col-nextMonth" :style="{'line-height':(showLunar)?'auto':'37px'}" v-for='item in afterDateList'
46
+ :key='item.key' @click="addMonth" :class="{'calendar-out-of-Date' : item.outOfDate }">
47
+ {{item.dateIndex}}
48
+ <p class='calendar-span'>{{item.markText}}</p>
49
+ </div>
50
+ </div>
51
+ <div class="ClearBoth"></div>
52
+ </div>
53
+ <div class="cle-but-cont">
54
+ <button class="cle-but" @click="confirm">确认</button>
55
+ </div>
56
+ </div>
57
+ </div>
58
+ </template>
59
+
60
+ <script>
61
+ import lunarYearTool from './sloarToLunar.js'
62
+ export default {
63
+ name: 'zydx-calendar',
64
+ props: {
65
+ /**
66
+ * @description 当前时间 yyyy-MM-dd
67
+ */
68
+ currentTime: {
69
+ type: String,
70
+ default: function() {
71
+ let timeObj = new Date();
72
+ return timeObj.getFullYear() + "-" + (timeObj.getMonth() + 1) + "-" + timeObj.getDate();
73
+ }
74
+ },
75
+ /**
76
+ * @description 标记点列表
77
+ * time 标记时间 yyyy-MM-dd
78
+ * text 标记内容
79
+ * markPoint 是否显示标记点 默认false
80
+ * markTextColor 标记内容颜色
81
+ * pointText 左上角标记点内容
82
+ * pointTextColor 标记点颜色
83
+ */
84
+ mark: {
85
+ type: Array,
86
+ default: function() {
87
+ return undefined;
88
+ }
89
+ },
90
+ /**
91
+ * @description 上月文字
92
+ */
93
+ lastText: {
94
+ type: String,
95
+ default: '〈'
96
+ },
97
+ /**
98
+ * @description 下月文字
99
+ */
100
+ nextText: {
101
+ type: String,
102
+ default: '〉'
103
+ },
104
+ /**
105
+ * @description 全局标记点颜色,包括点和文字
106
+ */
107
+ maskColor: {
108
+ type: String,
109
+ default: '#01AAED'
110
+ },
111
+ /**
112
+ * @description 是否显示农历,mask优先级高
113
+ */
114
+ showLunar: {
115
+ type: Boolean,
116
+ default: true
117
+ },
118
+ /**
119
+ * @description 设置标记范围
120
+ */
121
+ range: {
122
+ type: Object,
123
+ default: function() {
124
+ return {
125
+ rangeStart: undefined, //设置标记范围开始,yyyy-MM-dd
126
+ rangeEnd: undefined //设置标记范围结束,yyyy-MM-dd
127
+ }
128
+ }
129
+ },
130
+ /**
131
+ * @description 是否开启范围选择模式
132
+ */
133
+ rangeMode: {
134
+ type: Boolean,
135
+ default: false
136
+ },
137
+ /**
138
+ * @description 日历起始时间 yyyy-MM-dd
139
+ */
140
+ dateStart: {
141
+ type: String,
142
+ default: '1970-01-01'
143
+ },
144
+ /**
145
+ * @description 日历结束时间 yyyy-MM-dd
146
+ */
147
+ dateEnd: {
148
+ type: String,
149
+ default: '2100-12-31'
150
+ },
151
+ /**
152
+ * @description 是否可以滚动
153
+ */
154
+ canDrag: {
155
+ type: Boolean,
156
+ default: true
157
+ },
158
+ },
159
+ created() {
160
+ this.render();
161
+ },
162
+ data() {
163
+ return {
164
+ nextDisabled: false,
165
+ lastDisabled: false,
166
+ currentSelectTime: undefined, //点击时保存的dateIndex
167
+ title_time: '', //顶头文本
168
+ year: undefined, //当前年
169
+ month: undefined, //当前月
170
+ beforeDateList: [], //上个月的日期列表
171
+ dateList: [], //本月的日期列表
172
+ afterDateList: [], //下个月的日期列表
173
+ firstRangeSelected: false, // 范围开始时间是否已经选择
174
+ rangeStart_: undefined, //标记范围开始,yyyyMM-dd
175
+ rangeEnd_: undefined, //标记范围结束,yyyyMM-dd
176
+ transform_x: 0,
177
+ transform_time: 0,
178
+ tileMonth: '',
179
+ monthY: '',
180
+ dayChange: '',
181
+ monthList: [{
182
+ id: '01',
183
+ name: 'January'
184
+ },
185
+ {
186
+ id: '02',
187
+ name: 'February'
188
+ },
189
+ {
190
+ id: '03',
191
+ name: 'March'
192
+ },
193
+ {
194
+ id: '04',
195
+ name: 'April'
196
+ },
197
+ {
198
+ id: '05',
199
+ name: 'May'
200
+ },
201
+ {
202
+ id: '06',
203
+ name: 'June'
204
+ },
205
+ {
206
+ id: '07',
207
+ name: 'July'
208
+ },
209
+ {
210
+ id: '08',
211
+ name: 'August'
212
+ },
213
+ {
214
+ id: '09',
215
+ name: 'September'
216
+ },
217
+ {
218
+ id: '10',
219
+ name: 'October'
220
+ },
221
+ {
222
+ id: '11',
223
+ name: 'November'
224
+ },
225
+ {
226
+ id: '12',
227
+ name: 'December'
228
+ },
229
+ ]
230
+ };
231
+ },
232
+ methods: {
233
+ confirm() {
234
+ let that = this
235
+ if(that.rangeMode) {
236
+ that.$emit('confirm', {
237
+ start: that.rangeStart_,
238
+ end: that.rangeEnd_
239
+ });
240
+ }else {
241
+ that.$emit('confirm', that.dayChange.time);
242
+ }
243
+ },
244
+ render(setTimeStr) { //初始化
245
+ let that = this;
246
+ let currentTimeStr = setTimeStr ? setTimeStr : that.currentTime;
247
+ let timeObj = this.toDateByStr(currentTimeStr); //当前选定的时间
248
+
249
+ //计算头部显示的年月
250
+ let _tempTileMonth = (timeObj.getMonth() + 1);
251
+ if (_tempTileMonth < 10)
252
+ _tempTileMonth = '0' + _tempTileMonth;
253
+ this.title_time = timeObj.getFullYear() + "年" + _tempTileMonth + "月";
254
+ this.tileMonth = _tempTileMonth
255
+ for (let i = 0; i < this.monthList.length; i++) {
256
+ if (this.monthList[i].id === _tempTileMonth) {
257
+ this.monthY = this.monthList[i].name
258
+ }
259
+ }
260
+
261
+ //获取当前时间月份1号
262
+ let firstDayStr = timeObj.getFullYear() + "/" + (timeObj.getMonth() + 1) + "/01";
263
+ let date = that.toDateByStr(firstDayStr);
264
+ that.year = date.getFullYear();
265
+ that.month = date.getMonth() + 1;
266
+ let firstDayWeek = date.getDay(); //第一天是星期几
267
+ let grid_sum = 0; //总格子数 ,用于后面填满格子
268
+ //获取上一个月的天数
269
+ let TempMonth;
270
+ let TempYear;
271
+ if (that.month == 1) { //跨年
272
+ TempMonth = 12;
273
+ TempYear = that.year - 1;
274
+ } else {
275
+ TempYear = that.year;
276
+ TempMonth = that.month - 1;
277
+ }
278
+ let TempLastMonthStr = TempYear + "/" + TempMonth + "/01";
279
+ let lastMonthTotalDay = that.getTotalDay(TempLastMonthStr);
280
+ let lastMonthStartDay = lastMonthTotalDay - firstDayWeek;
281
+
282
+ let _dateStart = that.toDateByStr1(that.dateStart);
283
+ let _dateEnd = that.toDateByStr1(that.dateEnd);
284
+ // 创建前面的日期
285
+ that.beforeDateList = [];
286
+ for (let i = 0; i < firstDayWeek; i++) {
287
+ grid_sum++;
288
+ lastMonthStartDay++;
289
+ let tempObj = {
290
+ dateIndex: lastMonthStartDay,
291
+ key: 'before_' + i
292
+ };
293
+
294
+ //判断是否超出日期范围
295
+ let _tempBeforeDate = new Date(TempYear + "/" + TempMonth + "/" + lastMonthStartDay);
296
+ if (_dateStart > _tempBeforeDate || _tempBeforeDate > _dateEnd) {
297
+ tempObj.outOfDate = true;
298
+ }
299
+
300
+ //获取农历
301
+ if (that.showLunar) {
302
+ let LunarDate = that.sloarToLunar(TempYear, TempMonth, lastMonthStartDay);
303
+ let tempLunarDay = LunarDate.lunarDay == '初一' ? LunarDate.lunarMonth + '月' : LunarDate.lunarDay;
304
+ tempObj.markText = tempLunarDay;
305
+ }
306
+
307
+ that.beforeDateList.push(tempObj);
308
+ }
309
+
310
+ //获取一个月的天数
311
+ let totalDay = that.getTotalDay(currentTimeStr);
312
+
313
+ //生成本月日历
314
+ let today = new Date();
315
+ let today_year = today.getFullYear();
316
+ let today_month = today.getMonth() + 1;
317
+ let today_day = today.getDate();
318
+ that.dateList = [];
319
+ for (let i = 1; i <= totalDay; i++) { //循环日
320
+ grid_sum++;
321
+
322
+ let tempObj = {
323
+ dateIndex: i,
324
+ key: 'date_' + i,
325
+ isRanges: false,
326
+ isToday: false
327
+ };
328
+ //当前日期变量
329
+ let tempDay = that.toDateByStr(that.year + "/" + that.month + "/" + i);
330
+
331
+ //判断是否为当天
332
+ if (today_year == that.year && today_month == that.month && today_day == i)
333
+ tempObj.isToday = true;
334
+
335
+ //周六和周日,特殊处理
336
+ let tempCurrWeek = tempDay.getDay();
337
+ if (tempCurrWeek == 0 || tempCurrWeek == 6)
338
+ tempObj.isDaySunOrSat = true;
339
+
340
+ //判断是否超出日期范围
341
+ if (_dateStart > tempDay || tempDay > _dateEnd) {
342
+ tempObj.outOfDate = true;
343
+ }
344
+
345
+ //获取农历
346
+ if (that.showLunar) {
347
+ let LunarDate = that.sloarToLunar(that.year, that.month, i);
348
+ that.lunarMonth = LunarDate.lunarMonth;
349
+ that.lunarYear = LunarDate.lunarYear;
350
+ let tempLunarDay = LunarDate.lunarDay == '初一' ? LunarDate.lunarMonth + '月' : LunarDate.lunarDay;
351
+ tempObj.lunarMonth = LunarDate.lunarMonth;
352
+ tempObj.lunarYear = LunarDate.lunarYear;
353
+ tempObj.lunarDay = LunarDate.lunarDay;
354
+ tempObj.markText = tempLunarDay;
355
+ tempObj.markTextColor = '#454545';
356
+ }
357
+
358
+ //设置了标记点
359
+ if (that.mark) {
360
+ for (let z = 0; z < that.mark.length; z++) { //判断是否为标记点
361
+ let tempDayMark = that.toDateByStr1(that.mark[z].time.trim())
362
+ if (tempDay.getTime() == tempDayMark.getTime()) {
363
+ let tempTextStr = that.mark[z].text
364
+ if (that.mark[z].markPoint != false) { // 是否显示点
365
+ tempObj.pointText = that.mark[z].pointText ? that.mark[z].pointText : '●';
366
+ tempObj.pointTextColor = that.mark[z].pointTextColor ? that.mark[z].pointTextColor :
367
+ undefined;
368
+ }
369
+ if (tempTextStr != undefined && tempTextStr != "") { // 是否显示文字
370
+ tempObj.markText = tempTextStr;
371
+ tempObj.markTextColor = that.mark[z].markTextColor ? that.mark[z].markTextColor :
372
+ undefined;
373
+ }
374
+ break;
375
+ }
376
+ }
377
+ }
378
+
379
+ that.dateList.push(tempObj);
380
+ }
381
+
382
+ that.setRange();
383
+
384
+ // 创建后面的空白,补够五行
385
+ that.afterDateList = [];
386
+ if (grid_sum < 42) { // 创建后面的空白,补够五行
387
+ let j = 0;
388
+
389
+ //获取下一月
390
+ let TempMonthNext;
391
+ let TempYearNext;
392
+ if (that.month == 12) { //跨年
393
+ TempMonthNext = 1;
394
+ TempYearNext = that.year + 1;
395
+ } else {
396
+ TempYearNext = that.year;
397
+ TempMonthNext = that.month + 1;
398
+ }
399
+
400
+ for (let i = grid_sum; i < 42; i++) {
401
+ j++;
402
+
403
+ let tempObj = {
404
+ dateIndex: j,
405
+ key: 'after_' + j
406
+ };
407
+ //获取农历
408
+ if (that.showLunar) {
409
+ let LunarDate = that.sloarToLunar(TempYearNext, TempMonthNext, j);
410
+ let tempLunarDay = LunarDate.lunarDay == '初一' ? LunarDate.lunarMonth + '月' : LunarDate
411
+ .lunarDay;
412
+ tempObj.markText = tempLunarDay;
413
+ }
414
+
415
+ //判断是否超出日期范围
416
+ let _tempAfterDate = new Date(TempYearNext + "/" + TempMonthNext + "/" + j);
417
+ if (_dateStart > _tempAfterDate || _tempAfterDate > _dateEnd) {
418
+ tempObj.outOfDate = true;
419
+ }
420
+
421
+ that.afterDateList.push(tempObj);
422
+ }
423
+ }
424
+ that.selectedDateFun(today_day)
425
+ },
426
+ sloarToLunar(year, month, day) {
427
+ // console.log('----')
428
+ // console.log(year + "--" +month+ "--" + day)
429
+ let result = lunarYearTool.sloarToLunar(year, month, day);
430
+ //console.log(result)
431
+ return result;
432
+ },
433
+ getTotalDay(time) { //获取月 日期总数
434
+ time = time.replace(/-/g, "/");
435
+ let selectedDate = new Date(time);
436
+ if (selectedDate == "Invalid Date") {
437
+ selectedDate = new Date(time + "/01");
438
+ }
439
+
440
+ let dayMany = new Date(selectedDate.getFullYear(), (selectedDate.getMonth() + 1), 0).getDate()
441
+ return dayMany;
442
+ },
443
+ toDateByStr(timeStr) { //字符串转换时间,转换失败或者不传字符串则返回当前
444
+ let timeObj;
445
+ if (timeStr) {
446
+ timeObj = new Date(timeStr.replace(/-/g, "/"));
447
+ }
448
+ if (!timeStr || timeObj == "Invalid Date")
449
+ timeObj = new Date();
450
+ return timeObj;
451
+ },
452
+ toDateByStr1(timeStr) { //字符串转换时间,转换失败或者不传字符串则null
453
+ try {
454
+ let timeObj;
455
+ if (timeStr) {
456
+ timeObj = new Date(timeStr.replace(/-/g, "/"));
457
+ }
458
+ if (!timeStr || timeObj == "Invalid Date")
459
+ return null;
460
+ return timeObj;
461
+ } catch (e) {
462
+ return null;
463
+ }
464
+ },
465
+ selectedDateFun(index) { //点击日期
466
+ let that = this;
467
+ let selectObj = that.dateList[index - 1];
468
+ selectObj.year = that.year;
469
+ selectObj.month = that.month;
470
+ selectObj.day = index;
471
+ selectObj.time = that.year + "-" + that.month + "-" + index;
472
+ that.$emit('dayChange', selectObj);
473
+ that.dayChange = selectObj
474
+
475
+ //判断是否超出日期范围
476
+ if (that.checkOutOfDate(selectObj.time)) {
477
+ return;
478
+ }
479
+
480
+ that.currentSelectTime = index;
481
+
482
+ //开启了范围选择模式
483
+ if (that.rangeMode) {
484
+ if (!that.firstRangeSelected) { //选择开始时间
485
+ that.firstRangeSelected = !that.firstRangeSelected
486
+ that.rangeStart_ = selectObj.time;
487
+ that.rangeEnd_ = undefined;
488
+ that.clearRange();
489
+ } else { //选择了结束时间
490
+ that.rangeEnd_ = selectObj.time;
491
+ that.firstRangeSelected = !that.firstRangeSelected
492
+ that.$emit('rangeChange', {
493
+ start: that.rangeStart_,
494
+ end: that.rangeEnd_,
495
+ });
496
+ that.setRange();
497
+ }
498
+ }
499
+ },
500
+ subYear() { //减一年
501
+ let that = this
502
+ let _Month = that.month;
503
+ let _Year = that.year;
504
+ _Year -= 1
505
+ let str = _Year + "/" + _Month + "/01";
506
+ that.$emit('monthChange', {
507
+ date: str
508
+ });
509
+ that.render(str);
510
+ },
511
+ addYear() { //加一年
512
+ let that = this
513
+ let _Month = that.month;
514
+ let _Year = that.year;
515
+ _Year += 1
516
+ let str = _Year + "/" + _Month + "/01";
517
+ that.$emit('monthChange', {
518
+ date: str
519
+ });
520
+ that.render(str);
521
+ },
522
+ addMonth() { //加一个月
523
+ let that = this;
524
+
525
+ let _Month = that.month;
526
+ let _Year = that.year;
527
+ if (that.month == 12) { //跨年
528
+ _Month = 1;
529
+ _Year += 1;
530
+ } else {
531
+ _Month += 1;
532
+ }
533
+
534
+ let str = _Year + "/" + _Month + "/01";
535
+
536
+ //判断是否超出日期范围
537
+ if (that.checkOutOfDate(str)) {
538
+ that.nextDisabled = true;
539
+ return;
540
+ }
541
+
542
+ that.month = _Month;
543
+ that.year = _Year;
544
+ that.lastDisabled = false;
545
+
546
+ //检查日期上限值是否在当月内,如果在则不能再切换下个月
547
+ if (that.checkDateRange(that.year, that.month, 1)) {
548
+ that.nextDisabled = true;
549
+ }
550
+
551
+ if (that.rangeMode) { //开启了范围模式
552
+ that.currentSelectTime = undefined;
553
+ }
554
+
555
+ that.$emit('monthChange', {
556
+ date: str
557
+ });
558
+ that.render(str);
559
+ },
560
+ subMonth() { //减一个月
561
+ let that = this;
562
+
563
+ let _Month = that.month;
564
+ let _Year = that.year;
565
+ if (that.month == 1) { //跨年
566
+ _Month = 12;
567
+ _Year -= 1;
568
+ } else {
569
+ _Month -= 1;
570
+ }
571
+
572
+ let str = _Year + "/" + _Month + "/01";
573
+
574
+ //判断是否超出日期范围
575
+ let _totalDay = that.getTotalDay(str);
576
+ if (that.checkOutOfDate(_Year + "/" + _Month + "/" + _totalDay)) {
577
+ that.lastDisabled = true;
578
+ return;
579
+ }
580
+
581
+ that.month = _Month;
582
+ that.year = _Year;
583
+ that.nextDisabled = false;
584
+
585
+ //检查日期下限值是否在当月内,如果在则不能再切换上个月
586
+ if (that.checkDateRange(that.year, that.month)) {
587
+ that.lastDisabled = true;
588
+ }
589
+
590
+ if (that.rangeMode) { //开启了范围模式
591
+ that.currentSelectTime = undefined;
592
+ }
593
+
594
+ that.$emit('monthChange', {
595
+ date: str
596
+ });
597
+ that.render(str);
598
+ },
599
+ setRange() { //设置范围
600
+ let that = this;
601
+ let rangeStartDate = that.toDateByStr1(that.rangeStart_);
602
+ let rangeEndDate = that.toDateByStr1(that.rangeEnd_);
603
+ if (!rangeStartDate || !rangeEndDate)
604
+ return;
605
+ if (rangeStartDate > rangeEndDate) { //防止范围出错
606
+ let tempD = rangeEndDate;
607
+ rangeEndDate = rangeStartDate;
608
+ rangeStartDate = tempD;
609
+ }
610
+
611
+ //循环判断范围
612
+ for (let i = 0; i < that.dateList.length; i++) {
613
+ let _TempDtStr = that.year + "/" + that.month + "/" + that.dateList[i].dateIndex;
614
+ let _TempDt = that.toDateByStr1(_TempDtStr);
615
+ that.dateList[i].isRanges = false;
616
+ if (rangeStartDate <= _TempDt && _TempDt <= rangeEndDate) //时间在范围内
617
+ that.dateList[i].isRanges = true;
618
+ }
619
+ },
620
+ clearRange() { //关闭范围模式范围
621
+ let that = this;
622
+ //循环判断范围
623
+ for (let i = 0; i < that.dateList.length; i++) {
624
+ that.dateList[i].isRanges = false;
625
+ }
626
+ },
627
+ checkOutOfDate(time) { //判断是否超出日期范围,yyyy-MM-dd
628
+ let that = this;
629
+ let _dateStart = that.toDateByStr1(that.dateStart);
630
+ let _dateEnd = that.toDateByStr1(that.dateEnd);
631
+ let _tempDate = that.toDateByStr1(time);
632
+ if (_dateStart > _tempDate || _tempDate > _dateEnd) {
633
+ return true;
634
+ } else
635
+ return false;
636
+ },
637
+ checkDateRange(year, month, type) { //判断范围界限值是否在当月内,yyyy-MM-dd,type;1 上限值,其他:下限值
638
+ let that = this;
639
+
640
+ let totalDay = that.getTotalDay(year + '/' + month + '/01');
641
+ let firstD = that.toDateByStr1(year + '/' + month + '/01');
642
+ let lastD = that.toDateByStr1(year + '/' + month + '/' + totalDay);
643
+
644
+ if (type == 1) { //上限值
645
+ let _dateEnd = that.toDateByStr1(that.dateEnd);
646
+ if (firstD <= _dateEnd && _dateEnd <= lastD) {
647
+ return true;
648
+ } else
649
+ return false;
650
+ } else { //下限值
651
+ let _dateStart = that.toDateByStr1(that.dateStart);
652
+ if (firstD <= _dateStart && _dateStart <= lastD) {
653
+ return true;
654
+ } else
655
+ return false;
656
+ }
657
+ }
658
+ },
659
+ watch: {
660
+ currentTime: function(val, oldVal) { //时间改变
661
+ let dateNew = this.toDateByStr1(val);
662
+ if (dateNew.getFullYear() == this.year && (dateNew.getMonth() + 1) == this.month) {
663
+ console.log('time is not change')
664
+ } else {
665
+ this.currentSelectTime = dateNew.getDate();
666
+ this.render();
667
+ }
668
+ },
669
+ range: function(val, oldVal) { //范围改变
670
+ if (val.rangeStart != oldVal.rangeStart || val.rangeEnd != oldVal.rangeEnd) {
671
+ this.rangeStart_ = val.rangeStart;
672
+ this.rangeEnd_ = val.rangeEnd;
673
+ this.setRange();
674
+ }
675
+ },
676
+ mark: function(val, oldVal) { //标记改变
677
+ this.render();
678
+ },
679
+ rangeMode: function(val, oldVal) { //范围改变
680
+ if (!val) { //如果是关闭范围模式
681
+ this.rangeStart_ = undefined; //标记范围开始,yyyyMM-dd
682
+ this.rangeEnd_ = undefined; //标记范围结束,yyyyMM-dd
683
+ this.firstRangeSelected = false;
684
+ this.clearRange()
685
+ }
686
+ },
687
+ },
688
+ computed: {
689
+ transformObj: function() {
690
+ return 'translate3d(' + this.transform_x + 'px, 0px, 0px) translateZ(0px)';
691
+ },
692
+ transformTimeObj: function() {
693
+ return this.transform_time + 'ms';
694
+ }
695
+ },
696
+ }
697
+ </script>
698
+
699
+ <style scoped src="./Calendar.css"></style>
@@ -0,0 +1,195 @@
1
+ /* 公历转农历代码思路:
2
+ 1、建立农历年份查询表
3
+ 2、计算输入公历日期与公历基准的相差天数
4
+ 3、从农历基准开始遍历农历查询表,计算自农历基准之后每一年的天数,并用相差天数依次相减,确定农历年份
5
+ 4、利用剩余相差天数以及农历每个月的天数确定农历月份
6
+ 5、利用剩余相差天数确定农历哪一天 */
7
+ var lunarYearTool = {
8
+ // 农历1949-2100年查询表
9
+ lunarYearArr: [
10
+ 0x0b557, //1949
11
+ 0x06ca0, 0x0b550, 0x15355, 0x04da0, 0x0a5b0, 0x14573, 0x052b0, 0x0a9a8, 0x0e950, 0x06aa0, //1950-1959
12
+ 0x0aea6, 0x0ab50, 0x04b60, 0x0aae4, 0x0a570, 0x05260, 0x0f263, 0x0d950, 0x05b57, 0x056a0, //1960-1969
13
+ 0x096d0, 0x04dd5, 0x04ad0, 0x0a4d0, 0x0d4d4, 0x0d250, 0x0d558, 0x0b540, 0x0b6a0, 0x195a6, //1970-1979
14
+ 0x095b0, 0x049b0, 0x0a974, 0x0a4b0, 0x0b27a, 0x06a50, 0x06d40, 0x0af46, 0x0ab60, 0x09570, //1980-1989
15
+ 0x04af5, 0x04970, 0x064b0, 0x074a3, 0x0ea50, 0x06b58, 0x055c0, 0x0ab60, 0x096d5, 0x092e0, //1990-1999
16
+ 0x0c960, 0x0d954, 0x0d4a0, 0x0da50, 0x07552, 0x056a0, 0x0abb7, 0x025d0, 0x092d0, 0x0cab5, //2000-2009
17
+ 0x0a950, 0x0b4a0, 0x0baa4, 0x0ad50, 0x055d9, 0x04ba0, 0x0a5b0, 0x15176, 0x052b0, 0x0a930, //2010-2019
18
+ 0x07954, 0x06aa0, 0x0ad50, 0x05b52, 0x04b60, 0x0a6e6, 0x0a4e0, 0x0d260, 0x0ea65, 0x0d530, //2020-2029
19
+ 0x05aa0, 0x076a3, 0x096d0, 0x04afb, 0x04ad0, 0x0a4d0, 0x1d0b6, 0x0d250, 0x0d520, 0x0dd45, //2030-2039
20
+ 0x0b5a0, 0x056d0, 0x055b2, 0x049b0, 0x0a577, 0x0a4b0, 0x0aa50, 0x1b255, 0x06d20, 0x0ada0, //2040-2049
21
+ 0x14b63, 0x09370, 0x049f8, 0x04970, 0x064b0, 0x168a6, 0x0ea50, 0x06b20, 0x1a6c4, 0x0aae0, //2050-2059
22
+ 0x0a2e0, 0x0d2e3, 0x0c960, 0x0d557, 0x0d4a0, 0x0da50, 0x05d55, 0x056a0, 0x0a6d0, 0x055d4, //2060-2069
23
+ 0x052d0, 0x0a9b8, 0x0a950, 0x0b4a0, 0x0b6a6, 0x0ad50, 0x055a0, 0x0aba4, 0x0a5b0, 0x052b0, //2070-2079
24
+ 0x0b273, 0x06930, 0x07337, 0x06aa0, 0x0ad50, 0x14b55, 0x04b60, 0x0a570, 0x054e4, 0x0d160, //2080-2089
25
+ 0x0e968, 0x0d520, 0x0daa0, 0x16aa6, 0x056d0, 0x04ae0, 0x0a9d4, 0x0a2d0, 0x0d150, 0x0f252, //2090-2099
26
+ 0x0d520 //2100
27
+ ],
28
+ lunarMonth: ['正', '二', '三', '四', '五', '六', '七', '八', '九', '十', '冬', '腊'],
29
+ lunarDay: ['一', '二', '三', '四', '五', '六', '七', '八', '九', '十', '初', '廿'],
30
+ tianGan: ['甲', '乙', '丙', '丁', '戊', '己', '庚', '辛', '壬', '癸'],
31
+ diZhi: ['子', '丑', '寅', '卯', '辰', '巳', '午', '未', '申', '酉', '戌', '亥'],
32
+ /**
33
+ * @description 公历转农历函数
34
+ * @param {int} sy 年份
35
+ * @param {int} sm 月份
36
+ * @param {int} sd 日期
37
+ * */
38
+ sloarToLunar: function(sy, sm, sd) { //
39
+ let that = this;
40
+ // 输入的月份减1处理
41
+ sm -= 1;
42
+
43
+ // 计算与公历基准的相差天数
44
+ // Date.UTC()返回的是距离公历1970年1月1日的毫秒数,传入的月份需要减1
45
+ let daySpan = (Date.UTC(sy, sm, sd) - Date.UTC(1949, 0, 29)) / (24 * 60 * 60 * 1000) + 1;
46
+ let ly, lm, ld;
47
+ // 确定输出的农历年份
48
+ for (let j = 0; j < that.lunarYearArr.length; j++) {
49
+ let tempDaySpan = that.lunarYearDays(that.lunarYearArr[j]);
50
+ daySpan -= tempDaySpan
51
+ if (daySpan <= 0) {
52
+ ly = 1949 + j;
53
+ // 获取农历年份确定后的剩余天数
54
+ daySpan += tempDaySpan;
55
+ break
56
+ }
57
+ }
58
+
59
+ // 确定输出的农历月份
60
+ let lunarYearMonthsList = that.lunarYearMonths(that.lunarYearArr[ly - 1949])
61
+ let hasLeapMonth_Result = that.hasLeapMonth(that.lunarYearArr[ly - 1949]);
62
+ for (let k = 0; k < lunarYearMonthsList.length; k++) {
63
+ daySpan -= lunarYearMonthsList[k];
64
+ if (daySpan <= 0) {
65
+ // 有闰月时,月份的数组长度会变成13,因此,当闰月月份小于等于k时,lm不需要加1
66
+ if (hasLeapMonth_Result && hasLeapMonth_Result <= k) {
67
+ if (hasLeapMonth_Result < k) {
68
+ lm = k;
69
+ } else if (hasLeapMonth_Result === k) {
70
+ lm = '闰' + k;
71
+ } else {
72
+ lm = k + 1;
73
+ }
74
+ } else {
75
+ lm = k + 1;
76
+ }
77
+ // 获取农历月份确定后的剩余天数
78
+ daySpan += lunarYearMonthsList[k];
79
+ break
80
+ }
81
+ }
82
+
83
+ // 确定输出农历哪一天
84
+ ld = daySpan;
85
+
86
+ // 将计算出来的农历月份转换成汉字月份,闰月需要在前面加上闰字
87
+ if (hasLeapMonth_Result && (typeof(lm) === 'string' && lm.indexOf('闰') > -1)) {
88
+ lm = `闰${this.lunarMonth[/\d/.exec(lm) - 1]}`
89
+ } else {
90
+ lm = that.lunarMonth[lm - 1];
91
+ }
92
+
93
+ // 将计算出来的农历年份转换为天干地支年
94
+ ly = that.getTianGan(ly) + that.getDiZhi(ly);
95
+
96
+ // 将计算出来的农历天数转换成汉字
97
+ if (ld < 11) {
98
+ ld = `${this.lunarDay[10]}${this.lunarDay[ld-1]}`
99
+ } else if (ld > 10 && ld < 20) {
100
+ ld = `${this.lunarDay[9]}${this.lunarDay[ld-11]}`
101
+ } else if (ld === 20) {
102
+ ld = `${this.lunarDay[1]}${this.lunarDay[9]}`
103
+ } else if (ld > 20 && ld < 30) {
104
+ ld = `${this.lunarDay[11]}${this.lunarDay[ld-21]}`
105
+ } else if (ld === 30) {
106
+ ld = `${this.lunarDay[2]}${this.lunarDay[9]}`
107
+ }
108
+
109
+ return {
110
+ lunarYear: ly,
111
+ lunarMonth: lm,
112
+ lunarDay: ld,
113
+ }
114
+ },
115
+ /**
116
+ * @description 计算农历年是否有闰月,参数为存储农历年的16进制
117
+ * 农历年份信息用16进制存储,其中16进制的最后1位可以用于判断是否有闰月
118
+ * */
119
+ hasLeapMonth: function(ly) {
120
+ // 获取16进制的最后1位,需要用到&与运算符
121
+ if (ly & 0xf) {
122
+ return ly & 0xf
123
+ } else {
124
+ return false
125
+ }
126
+ },
127
+ /**
128
+ * @description 如果有闰月,计算农历闰月天数,参数为存储农历年的16进制
129
+ * 农历年份信息用16进制存储,其中16进制的第1位(0x除外)可以用于表示闰月是大月还是小月
130
+ * */
131
+ leapMonthDays: function(ly) {
132
+ if (this.hasLeapMonth(ly)) {
133
+ // 获取16进制的第1位(0x除外)
134
+ return (ly & 0xf0000) ? 30 : 29
135
+ } else {
136
+ return 0
137
+ }
138
+ },
139
+ /**
140
+ * @description 计算农历一年的总天数,参数为存储农历年的16进制
141
+ * 农历年份信息用16进制存储,其中16进制的第2-4位(0x除外)可以用于表示正常月是大月还是小月
142
+ * */
143
+ lunarYearDays: function(ly) {
144
+ let totalDays = 0;
145
+
146
+ // 获取正常月的天数,并累加
147
+ // 获取16进制的第2-4位,需要用到>>移位运算符
148
+ for (let i = 0x8000; i > 0x8; i >>= 1) {
149
+ let monthDays = (ly & i) ? 30 : 29;
150
+ totalDays += monthDays;
151
+ }
152
+ // 如果有闰月,需要把闰月的天数加上
153
+ if (this.hasLeapMonth(ly)) {
154
+ totalDays += this.leapMonthDays(ly);
155
+ }
156
+
157
+ return totalDays
158
+ },
159
+ /**
160
+ * @description 获取农历每个月的天数 参数需传入16进制数值
161
+ * */
162
+ lunarYearMonths: function(ly) {
163
+ let monthArr = [];
164
+ let that = this;
165
+ // 获取正常月的天数,并添加到monthArr数组中
166
+ // 获取16进制的第2-4位,需要用到>>移位运算符
167
+ for (let i = 0x8000; i > 0x8; i >>= 1) {
168
+ monthArr.push((ly & i) ? 30 : 29);
169
+ }
170
+ // 如果有闰月,需要把闰月的天数加上
171
+ if (this.hasLeapMonth(ly)) {
172
+ monthArr.splice(this.hasLeapMonth(ly), 0, that.leapMonthDays(ly));
173
+ }
174
+
175
+ return monthArr
176
+ },
177
+ /**
178
+ * @description 将农历年转换为天干,参数为农历年
179
+ * */
180
+ getTianGan: function(ly) {
181
+ let tianGanKey = (ly - 3) % 10;
182
+ if (tianGanKey === 0) tianGanKey = 10;
183
+ return this.tianGan[tianGanKey - 1]
184
+ },
185
+ /**
186
+ * @description 将农历年转换为地支,参数为农历年
187
+ * */
188
+ getDiZhi: function(ly) {
189
+ let diZhiKey = (ly - 3) % 12;
190
+ if (diZhiKey === 0) diZhiKey = 12;
191
+ return this.diZhi[diZhiKey - 1]
192
+ }
193
+ }
194
+
195
+ export default lunarYearTool;
@@ -1,7 +1,35 @@
1
- import publicTable from './src/main';
1
+ import { createVNode, render } from 'vue'
2
+ import XtxConfirm from './src/main.vue'
2
3
 
3
- publicTable.install = function(Vue) {
4
- Vue.component(publicTable.name, publicTable);
5
- };
4
+ // 准备div容器
5
+ const divNode = createVNode('div', { class: 'xtx-confirm-container' })
6
+ render(divNode, document.body)
7
+ // 获取 DOM 节点, 用于挂载组件或卸载组件
8
+ const container = divNode.el
6
9
 
7
- export default publicTable;
10
+ // 导出函数可通过调用 Confirm() 函数动态创建 XtxConfirm 组件
11
+ const Confirm = ({ type, url ,title, promptContent, middle, cancelShow, inputArr }) => {
12
+ // 返回 Promise 对象
13
+ return new Promise((resolve, reject) => {
14
+ // 2. 点击确认按钮,触发resolve同时销毁组件
15
+ const submit = () => {
16
+ let val = '点击确认'
17
+ if(type === 'input') {
18
+ val = inputArr.map(x => {
19
+ return x.value
20
+ })
21
+ }
22
+ render(null, container)
23
+ resolve(val)
24
+ }
25
+ // 3. 点击取消按钮,触发reject同时销毁组件
26
+ const cancel = () => {
27
+ render(null, container)
28
+ reject('点击取消')
29
+ }
30
+ // 1. 创建 XtxConfirm 组件
31
+ const VNode = createVNode(XtxConfirm, { type, url ,title, promptContent, middle, cancelShow, inputArr, submit, cancel })
32
+ render(VNode, container)
33
+ })
34
+ }
35
+ export default Confirm
@@ -11,6 +11,16 @@
11
11
  <div class="tip-img" v-if="type === 'img'">
12
12
  <img :src="url" />
13
13
  </div>
14
+ <div class="tip-img" v-if="type === 'input'">
15
+ <div class="tip-input" v-for="(item,index) in inputArr" :key="index">
16
+ <span>{{ item.name }}</span>
17
+ <input v-if="item.type === 'input'" type="text" :placeholder="item.placeholder" v-model="item.value" :disabled="item.disabled" />
18
+ <select v-if="item.type === 'select'" :disabled="item.disabled" v-model="item.value" :placeholder="item.placeholder">
19
+ <option value="1" v-for="(it,ind) in item.option" :key="ind">{{ it.name }}</option>
20
+ </select>
21
+ <div v-if="item.type === 'text'" class="text">{{ item.value }}</div>
22
+ </div>
23
+ </div>
14
24
  </div>
15
25
  </div>
16
26
  <div class="tip-btnBox">
@@ -46,21 +56,23 @@ export default {
46
56
  type: Boolean,
47
57
  default: true
48
58
  },
49
- cancelShow: {
59
+ cancelShow: { //是否显示取消按钮
50
60
  type: Boolean,
51
61
  default: true
52
- }
53
- },
54
- data () {
55
- return {}
56
- },
57
- methods: {
58
- submit: function (val) {
59
- this.$emit('rheResults', val)
60
62
  },
61
- cancel: function () {
62
- this.$emit('cancel')
63
- }
63
+ inputArr: { // 弹窗的提示标题
64
+ type: Array,
65
+ default: []
66
+ },
67
+ // 确认按钮
68
+ submit: {
69
+ type: Function,
70
+ default: () => {}
71
+ },
72
+ cancel: {
73
+ type: Function,
74
+ default: () => {}
75
+ },
64
76
  }
65
77
  }
66
78
  </script>
@@ -16,6 +16,7 @@
16
16
  border-radius: 5px;
17
17
  border: 5px rgba(0, 0, 0, .1) solid;
18
18
  margin: 0 auto;
19
+ box-sizing: border-box;
19
20
  }
20
21
  .tip-boxContent{
21
22
  max-height: 600px;
@@ -79,9 +80,47 @@ font-size: 12px;
79
80
  text-align: center;
80
81
  }
81
82
  .tip-img{
82
- width: 70%;
83
+ width: 100%;
83
84
  display: inline-block;
84
85
  }
85
86
  .tip-img>img{
86
87
  width: 100%;
87
88
  }
89
+ .tip-input{
90
+ display: inline-block;
91
+ padding-bottom: 15px;
92
+ }
93
+ .tip-input:last-child{
94
+ padding-bottom: 0;
95
+ }
96
+ .tip-input>span{
97
+ font-size: 16px;
98
+ font-weight: bold;
99
+ display: inline-block;
100
+ line-height: 30px;
101
+ padding-right: 10px;
102
+ }
103
+ .tip-input>input{
104
+ width: 210px;
105
+ height: 30px;
106
+ box-sizing: border-box;
107
+ font-size: 16px;
108
+ outline: none;
109
+ padding-left: 10px;
110
+ border: 1px solid #ccc;
111
+ }
112
+ .tip-input>select{
113
+ width: 210px;
114
+ height: 30px;
115
+ box-sizing: border-box;
116
+ font-size: 16px;
117
+ outline: none;
118
+ padding-left: 10px;
119
+ border: 1px solid #ccc;
120
+ }
121
+ .text{
122
+ display: inline-block;
123
+ font-size: 16px;
124
+ width: 210px;
125
+ text-align: left;
126
+ }
package/src/index.js CHANGED
@@ -1,21 +1,20 @@
1
1
  import tipBox from './components/tipBox/index';
2
+ import Calendar from './components/calendar/index';
2
3
 
3
4
  const components = [
4
- tipBox
5
+ Calendar
5
6
  ];
6
7
 
7
- const install = function(Vue, opts = {}) {
8
+ function install(app) {
8
9
  components.forEach(component => {
9
- Vue.component(component.name, component);
10
+ app.component(component.name, component);
10
11
  });
11
- };
12
-
13
- if (typeof window !== 'undefined' && window.Vue) {
14
- install(window.Vue);
12
+ app.config.globalProperties.$message = tipBox
15
13
  }
16
14
 
17
15
  export default {
18
- version: '1.0.6',
16
+ version: '1.0.7',
19
17
  install,
20
- tipBox
18
+ Calendar
21
19
  };
20
+