@vtx/ember
Advanced tools
@@ -82,2 +82,5 @@ <template> | ||
| watch: { | ||
| modelValue() { | ||
| this.init(); | ||
| }, | ||
| show(newValue, oldValue) { | ||
@@ -298,17 +301,18 @@ if (newValue) { | ||
| correctValue(value) { | ||
| let isDateMode = true; | ||
| if (this.mode !== 'time' || this.mode !== 'hourMinute' || this.mode !== 'year') { | ||
| isDateMode = false; | ||
| const isTimeMode = this.mode === 'time' || this.mode === 'hourMinute'; | ||
| if (!value) { | ||
| if (this.mode === 'year') { | ||
| value = dayjs(this.minDate).year(); | ||
| } else if (isTimeMode) { | ||
| // 如果是时间类型,而又没有默认值的话,就用最小时间 | ||
| value = `${uni.$u.padZero(this.minHour)}:${uni.$u.padZero( | ||
| this.minMinute, | ||
| )}:${uni.$u.padZero(this.minSecond)}`; | ||
| } else { | ||
| // 如果是日期类型,但是又没有设置合法的当前时间的话,使用最小时间为当前时间 | ||
| value = this.minDate; | ||
| } | ||
| } | ||
| if (isDateMode && !uni.$u.test.date(value)) { | ||
| // 如果是日期类型,但是又没有设置合法的当前时间的话,使用最小时间为当前时间 | ||
| value = this.minDate; | ||
| } else if (!isDateMode && !value) { | ||
| // 如果是时间类型,而又没有默认值的话,就用最小时间 | ||
| value = `${uni.$u.padZero(this.minHour)}:${uni.$u.padZero( | ||
| this.minMinute, | ||
| )}:${uni.$u.padZero(this.minSecond)}`; | ||
| } | ||
| // 时间类型 | ||
| if (!isDateMode && this.mode === 'hourMinute') { | ||
| if (this.mode === 'hourMinute') { | ||
| if (String(value).indexOf(':') === -1) | ||
@@ -323,3 +327,3 @@ return uni.$u.error('时间错误,请传递如12:24的格式'); | ||
| return `${hour}:${minute}`; | ||
| } else if (!isDateMode && this.mode === 'time') { | ||
| } else if (this.mode === 'time') { | ||
| if (String(value).indexOf(':') === -1) | ||
@@ -337,6 +341,7 @@ return uni.$u.error('时间错误,请传递如12:24的格式'); | ||
| return `${hour}:${minute}:${second}`; | ||
| } else if (!isDateMode && this.mode === 'year') { | ||
| } else if (this.mode === 'year') { | ||
| return `${value}`; | ||
| } else { | ||
| // 如果是日期格式,控制在最小日期和最大日期之间 | ||
| value = dayjs(value).isValid() ? value : this.minDate; | ||
| value = dayjs(value).isBefore(dayjs(this.minDate)) ? this.minDate : value; | ||
@@ -343,0 +348,0 @@ value = dayjs(value).isAfter(dayjs(this.maxDate)) ? this.maxDate : value; |
@@ -24,12 +24,13 @@ <template> | ||
| :title-style="{ | ||
| color: value == item.value ? activeColor : inactiveColor, | ||
| color: currentValue == item.value ? activeColor : inactiveColor, | ||
| }" | ||
| > | ||
| <u-icon | ||
| v-if="value == item.value" | ||
| name="checkbox-mark" | ||
| :color="activeColor" | ||
| size="18" | ||
| slot="right-icon" | ||
| ></u-icon> | ||
| <template #right-icon> | ||
| <u-icon | ||
| v-if="currentValue == item.value" | ||
| name="checkbox-mark" | ||
| :color="activeColor" | ||
| size="18" | ||
| ></u-icon> | ||
| </template> | ||
| </u-cell> | ||
@@ -65,2 +66,6 @@ </u-cell-group> | ||
| }, | ||
| modelValue: { | ||
| type: [Number, String, Array], | ||
| default: undefined, | ||
| }, | ||
| // 菜单项标题 | ||
@@ -97,2 +102,5 @@ title: { | ||
| computed: { | ||
| currentValue() { | ||
| return this.modelValue !== undefined ? this.modelValue : this.value; | ||
| }, | ||
| // 监听props是否发生了变化,有些值需要传递给父组件v-dropdown,无法双向绑定 | ||
@@ -140,2 +148,3 @@ propsChange() { | ||
| // 修改通过v-model绑定的值 | ||
| this.$emit('update:modelValue', value); | ||
| this.$emit('input', value); | ||
@@ -142,0 +151,0 @@ // 通知父组件(v-dropdown)收起菜单 |
+6
-4
| { | ||
| "name": "@vtx/ember", | ||
| "version": "3.0.10", | ||
| "version": "3.0.12", | ||
| "scripts": { | ||
@@ -62,2 +62,3 @@ "start": "vuepress dev docs", | ||
| "@dcloudio/vite-plugin-uni": "3.0.0-3090420231025001", | ||
| "@qiun/ucharts": "^2.5.0-20230101", | ||
| "@types/node": "^20.8.10", | ||
@@ -97,6 +98,7 @@ "@vtx/utils": "^1.0.0", | ||
| "vue-i18n": "^9.1.9", | ||
| "vuepress": "^2.0.0-rc.0", | ||
| "@qiun/ucharts": "^2.5.0-20230101" | ||
| "vuepress": "^2.0.0-rc.0" | ||
| }, | ||
| "dependencies": {}, | ||
| "dependencies": { | ||
| "cross-env": "^10.1.0" | ||
| }, | ||
| "files": [ | ||
@@ -103,0 +105,0 @@ "components" |
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
0
-100%389290
-1.34%1
Infinity%+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added