wui-components-v2 1.1.59 → 1.1.60

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.
@@ -34,13 +34,14 @@ function clear() {
34
34
 
35
35
  watch(
36
36
  () => props.modelValue,
37
- (val) => {
37
+ val => {
38
38
  currentValue.value = val
39
- },
39
+ }
40
40
  )
41
41
 
42
- watch(currentValue, (val) => {
43
- emit('update:modelValue', val)
42
+ watch(currentValue, val => {
43
+ const newVal = props.type === 'year' ? dayjs(val).format('YYYY') : val
44
+ emit('update:modelValue', newVal)
44
45
  })
45
46
 
46
47
  const labelText = computed(() => {
@@ -51,13 +52,12 @@ const labelText = computed(() => {
51
52
  } = {
52
53
  date: 'YYYY-MM-DD',
53
54
  datetime: 'YYYY-MM-DD HH:mm',
54
- year:'YYYY'
55
+ year: 'YYYY',
55
56
  }
56
57
 
57
58
  if (['date', 'datetime', 'year'].includes(props.type)) {
58
59
  return currentValue.value ? dayjs(currentValue.value).format(formatMap[props.type] as string) : ''
59
- }
60
- else {
60
+ } else {
61
61
  return currentValue.value || ''
62
62
  }
63
63
  })
@@ -65,19 +65,13 @@ const labelText = computed(() => {
65
65
 
66
66
  <template>
67
67
  <div class="flex items-center justify-between">
68
- <wd-input
69
- v-model="labelText"
70
- readonly
71
- :placeholder="placeholder"
72
- class="flex-1"
73
- @click="open = true"
74
- />
68
+ <wd-input v-model="labelText" readonly :placeholder="placeholder" class="flex-1" @click="open = true" />
75
69
  <wd-icon v-if="labelText" name="close-circle" size="16px" @click="clear" />
76
70
  <wd-icon v-else name="right" size="16px" @click="clear" />
77
71
  </div>
78
72
 
79
73
  <wd-calendar
80
- v-if="['date', 'datetime',].includes(type)"
74
+ v-if="['date', 'datetime'].includes(type)"
81
75
  v-model="currentValue"
82
76
  v-model:visible="open"
83
77
  label-key="label"
@@ -100,13 +94,13 @@ const labelText = computed(() => {
100
94
  .custom-date-picker {
101
95
  width: 100%;
102
96
  :deep(.wd-calendar__wrapper) {
103
- padding : 0 20px;
104
- overflow: auto;
105
- scrollbar-width: none;
106
- -ms-overflow-style: none;
107
- }
108
- :deep(.uni-scroll-view) {
109
- scrollbar-width: none;
110
- }
97
+ padding: 0 20px;
98
+ overflow: auto;
99
+ scrollbar-width: none;
100
+ -ms-overflow-style: none;
101
+ }
102
+ :deep(.uni-scroll-view) {
103
+ scrollbar-width: none;
104
+ }
111
105
  }
112
106
  </style>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "wui-components-v2",
3
- "version": "1.1.59",
3
+ "version": "1.1.60",
4
4
  "description": "wui 组件库",
5
5
  "author": "wgxshh",
6
6
  "license": "MIT",