t20-common-lib 0.10.1 → 0.10.2

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": "t20-common-lib",
3
- "version": "0.10.1",
3
+ "version": "0.10.2",
4
4
  "description": "T20",
5
5
  "private": false,
6
6
  "main": "dist/index.js",
@@ -14,9 +14,9 @@
14
14
  "
15
15
  :type="type"
16
16
  :value-format="valueFormat"
17
- :placeholder="$l('选择日期')"
18
- :start-placeholder="$l('开始日期')"
19
- :end-placeholder="$l('结束日期')"
17
+ :placeholder="$lc('选择日期')"
18
+ :start-placeholder="$lc('开始日期')"
19
+ :end-placeholder="$lc('结束日期')"
20
20
  :picker-options="pickerOptionsAs"
21
21
  :clearable="clearable"
22
22
  v-bind="$attrs"
@@ -25,11 +25,12 @@
25
25
  </template>
26
26
 
27
27
  <script>
28
+ import { $lc } from '../../../src/utils/i18n/index'
28
29
  import dayjs from 'dayjs'
29
30
 
30
31
  const getShortcutDefinitions = () => ({
31
32
  'today': {
32
- text: this.$l('今天'),
33
+ text: $lc('今天'),
33
34
  onClick(picker) {
34
35
  const start = new Date()
35
36
  const end = new Date()
@@ -37,7 +38,7 @@ const getShortcutDefinitions = () => ({
37
38
  }
38
39
  },
39
40
  'recent-week': {
40
- text: this.$l('最近一周'),
41
+ text: $lc('最近一周'),
41
42
  onClick(picker) {
42
43
  const end = new Date()
43
44
  const start = new Date()
@@ -46,7 +47,7 @@ const getShortcutDefinitions = () => ({
46
47
  }
47
48
  },
48
49
  'recent-month': {
49
- text: this.$l('最近一月'),
50
+ text: $lc('最近一月'),
50
51
  onClick(picker) {
51
52
  const start = new Date()
52
53
  const end = new Date()
@@ -57,7 +58,7 @@ const getShortcutDefinitions = () => ({
57
58
  }
58
59
  },
59
60
  'recent-3-months': {
60
- text: this.$l('最近三月'),
61
+ text: $lc('最近三月'),
61
62
  onClick(picker) {
62
63
  const start = new Date()
63
64
  const end = new Date()
@@ -68,7 +69,7 @@ const getShortcutDefinitions = () => ({
68
69
  }
69
70
  },
70
71
  'recent-6-months': {
71
- text: this.$l('最近六月'),
72
+ text: $lc('最近六月'),
72
73
  onClick(picker) {
73
74
  const start = new Date()
74
75
  const end = new Date()
@@ -79,7 +80,7 @@ const getShortcutDefinitions = () => ({
79
80
  }
80
81
  },
81
82
  'recent-year': {
82
- text: this.$l('最近一年'),
83
+ text: $lc('最近一年'),
83
84
  onClick(picker) {
84
85
  const start = new Date()
85
86
  const end = new Date()
@@ -90,7 +91,7 @@ const getShortcutDefinitions = () => ({
90
91
  }
91
92
  },
92
93
  'recent-3-years': {
93
- text: this.$l('最近三年'),
94
+ text: $lc('最近三年'),
94
95
  onClick(picker) {
95
96
  const start = new Date()
96
97
  const end = new Date()
@@ -101,7 +102,7 @@ const getShortcutDefinitions = () => ({
101
102
  }
102
103
  },
103
104
  'start-from-today': {
104
- text: this.$l('今天开始'),
105
+ text: $lc('今天开始'),
105
106
  onClick(picker) {
106
107
  const start = dayjs().format('YYYY-MM-DD')
107
108
  const end = dayjs().add(99, 'year').format('YYYY-MM-DD')
@@ -109,7 +110,7 @@ const getShortcutDefinitions = () => ({
109
110
  }
110
111
  },
111
112
  'end-today': {
112
- text: this.$l('今天截止'),
113
+ text: $lc('今天截止'),
113
114
  onClick(picker) {
114
115
  const end = dayjs().format('YYYY-MM-DD')
115
116
  const start = dayjs().subtract(100, 'year').format('YYYY-MM-DD')
@@ -117,7 +118,7 @@ const getShortcutDefinitions = () => ({
117
118
  }
118
119
  },
119
120
  'current-month': {
120
- text: this.$l('当月'),
121
+ text: $lc('当月'),
121
122
  onClick(picker) {
122
123
  const start = dayjs().startOf('month').toDate()
123
124
  const end = dayjs().endOf('month').toDate()
@@ -125,7 +126,7 @@ const getShortcutDefinitions = () => ({
125
126
  }
126
127
  },
127
128
  'current-year': {
128
- text: this.$l('当年'),
129
+ text: $lc('当年'),
129
130
  onClick(picker) {
130
131
  const start = dayjs().startOf('year').toDate()
131
132
  const end = dayjs().endOf('year').toDate()
@@ -235,7 +236,7 @@ export default {
235
236
  }).filter(Boolean)
236
237
  }
237
238
 
238
- this.pickerOptionsAs = Object.assign(
239
+ const pickerOptionsAs = Object.assign(
239
240
  {
240
241
  disabledDate: this.minNow ? disabledDate_1 : this.maxNow ? disabledDate_2 : undefined,
241
242
  shortcuts
@@ -243,11 +244,14 @@ export default {
243
244
  this.pickerOptions
244
245
  )
245
246
 
246
- this.listeners = Object.assign({}, this.$listeners, {
247
+ const listeners = Object.assign({}, this.$listeners, {
247
248
  input: () => {},
248
249
  change: () => {}
249
250
  })
250
- return {}
251
+ return {
252
+ pickerOptionsAs,
253
+ listeners
254
+ }
251
255
  },
252
256
  computed: {
253
257
  valueC: {