n20-common-lib 2.5.0-beta.8 → 2.5.0-beta.9

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": "n20-common-lib",
3
- "version": "2.5.0-beta.8",
3
+ "version": "2.5.0-beta.9",
4
4
  "private": false,
5
5
  "main": "src/index.js",
6
6
  "scripts": {
@@ -18,27 +18,27 @@
18
18
 
19
19
  <script>
20
20
  import { $lc } from '../../utils/i18n/index'
21
- // import dayjs from 'dayjs'
22
- // let startDate = ''
21
+ import dayjs from 'dayjs'
22
+ let startDate = ''
23
23
 
24
- // const onPick = ({ maxDate, minDate }) => {
25
- // startDate = minDate.getMonth() + 1 + '-' + minDate.getDate()
26
- // let startSh = shortcuts_2.find((s) => s.text.includes($lc('开始')))
27
- // startSh.text = startDate + $lc('开始')
28
- // startSh.onClick = (picker) => {
29
- // const start = dayjs(minDate).format('YYYY-MM-DD HH:mm:ss')
30
- // const end = dayjs(minDate).add(100, 'year').format('YYYY-MM-DD HH:mm:ss')
31
- // picker.$emit('pick', [start, end])
32
- // }
24
+ const onPick = ({ maxDate, minDate }) => {
25
+ startDate = minDate.getMonth() + 1 + '-' + minDate.getDate()
26
+ let startSh = shortcuts_2.find((s) => s.text.includes($lc('开始')))
27
+ startSh.text = startDate + $lc('开始')
28
+ startSh.onClick = (picker) => {
29
+ const start = dayjs(minDate).format('YYYY-MM-DD HH:mm:ss')
30
+ const end = dayjs(minDate).add(100, 'year').format('YYYY-MM-DD HH:mm:ss')
31
+ picker.$emit('pick', [start, end])
32
+ }
33
33
 
34
- // let endSh = shortcuts_2.find((s) => s.text.includes($lc('截止')))
35
- // endSh.text = startDate + $lc('截止')
36
- // endSh.onClick = (picker) => {
37
- // const end = dayjs(minDate).format('YYYY-MM-DD HH:mm:ss')
38
- // const start = dayjs(minDate).subtract(100, 'year').format('YYYY-MM-DD HH:mm:ss')
39
- // picker.$emit('pick', [start, end])
40
- // }
41
- // }
34
+ let endSh = shortcuts_2.find((s) => s.text.includes($lc('截止')))
35
+ endSh.text = startDate + $lc('截止')
36
+ endSh.onClick = (picker) => {
37
+ const end = dayjs(minDate).format('YYYY-MM-DD HH:mm:ss')
38
+ const start = dayjs(minDate).subtract(100, 'year').format('YYYY-MM-DD HH:mm:ss')
39
+ picker.$emit('pick', [start, end])
40
+ }
41
+ }
42
42
 
43
43
  let disabledDate_1 = (t) => {
44
44
  let now = new Date()
@@ -95,23 +95,23 @@ let shortcuts_2 = [
95
95
  end.setHours(23, 59, 59)
96
96
  picker.$emit('pick', [start, end])
97
97
  }
98
+ },
99
+ {
100
+ text: $lc('今天开始'),
101
+ onClick(picker) {
102
+ const start = dayjs().format('YYYY-MM-DD HH:mm:ss')
103
+ const end = dayjs().add(99, 'year').format('YYYY-MM-DD HH:mm:ss')
104
+ picker.$emit('pick', [start, end])
105
+ }
106
+ },
107
+ {
108
+ text: $lc('今天截止'),
109
+ onClick(picker) {
110
+ const end = dayjs().format('YYYY-MM-DD HH:mm:ss')
111
+ const start = dayjs().subtract(100, 'year').format('YYYY-MM-DD HH:mm:ss')
112
+ picker.$emit('pick', [start, end])
113
+ }
98
114
  }
99
- // {
100
- // text: $lc('今天开始'),
101
- // onClick(picker) {
102
- // const start = dayjs().format('YYYY-MM-DD HH:mm:ss')
103
- // const end = dayjs().add(99, 'year').format('YYYY-MM-DD HH:mm:ss')
104
- // picker.$emit('pick', [start, end])
105
- // }
106
- // },
107
- // {
108
- // text: $lc('今天截止'),
109
- // onClick(picker) {
110
- // const end = dayjs().format('YYYY-MM-DD HH:mm:ss')
111
- // const start = dayjs().subtract(100, 'year').format('YYYY-MM-DD HH:mm:ss')
112
- // picker.$emit('pick', [start, end])
113
- // }
114
- // }
115
115
  ]
116
116
 
117
117
  export default {
@@ -165,13 +165,13 @@ export default {
165
165
  this.pickerOptionsAs = Object.assign(
166
166
  {
167
167
  disabledDate: this.minNow ? disabledDate_1 : this.maxNow ? disabledDate_2 : undefined,
168
- shortcuts
169
- // onPick
168
+ shortcuts,
169
+ onPick
170
170
  },
171
171
  this.pickerOptions
172
172
  )
173
173
 
174
- this.listeners = Object.assign({}, this.$listeners, { input: () => {}, change: () => {} })
174
+ this.listeners = Object.assign({}, this.$listeners, { input: () => {}, change: () => {}, blur: this.HandleBlur })
175
175
  return {}
176
176
  },
177
177
  computed: {
@@ -226,22 +226,22 @@ export default {
226
226
  }
227
227
  },
228
228
  methods: {
229
- // HandleBlur() {
230
- // let startSh = shortcuts_2.find((s) => s.text.includes($lc('开始')))
231
- // let endSh = shortcuts_2.find((s) => s.text.includes($lc('截止')))
232
- // startSh.text = $lc('今天开始')
233
- // startSh.onClick = (picker) => {
234
- // const start = dayjs().format('YYYY-MM-DD HH:mm:ss')
235
- // const end = dayjs().add(100, 'year').format('YYYY-MM-DD HH:mm:ss')
236
- // picker.$emit('pick', [start, end])
237
- // }
238
- // endSh.text = $lc('今天截止')
239
- // endSh.onClick = (picker) => {
240
- // const end = dayjs().format('YYYY-MM-DD HH:mm:ss')
241
- // const start = dayjs().subtract(100, 'year').format('YYYY-MM-DD HH:mm:ss')
242
- // picker.$emit('pick', [start, end])
243
- // }
244
- // }
229
+ HandleBlur() {
230
+ let startSh = shortcuts_2.find((s) => s.text.includes($lc('开始')))
231
+ let endSh = shortcuts_2.find((s) => s.text.includes($lc('截止')))
232
+ startSh.text = $lc('今天开始')
233
+ startSh.onClick = (picker) => {
234
+ const start = dayjs().format('YYYY-MM-DD HH:mm:ss')
235
+ const end = dayjs().add(100, 'year').format('YYYY-MM-DD HH:mm:ss')
236
+ picker.$emit('pick', [start, end])
237
+ }
238
+ endSh.text = $lc('今天截止')
239
+ endSh.onClick = (picker) => {
240
+ const end = dayjs().format('YYYY-MM-DD HH:mm:ss')
241
+ const start = dayjs().subtract(100, 'year').format('YYYY-MM-DD HH:mm:ss')
242
+ picker.$emit('pick', [start, end])
243
+ }
244
+ }
245
245
  }
246
246
  }
247
247
  </script>