yh-mobile-components 1.3.1 → 1.3.4
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/CHANGELOG.md +3 -0
- package/form/yhmInput.vue +12 -1
- package/form/yhmSelect.vue +15 -7
- package/form/yhmSwitch.vue +0 -2
- package/package.json +1 -1
package/CHANGELOG.md
ADDED
package/form/yhmInput.vue
CHANGED
|
@@ -7,6 +7,7 @@
|
|
|
7
7
|
@keydown="keydownHandler"
|
|
8
8
|
:type="inputType"
|
|
9
9
|
:error="error"
|
|
10
|
+
ref="fieldRef"
|
|
10
11
|
:error-message="errorMessage">
|
|
11
12
|
<template
|
|
12
13
|
#right-icon
|
|
@@ -28,7 +29,7 @@
|
|
|
28
29
|
</van-field>
|
|
29
30
|
</template>
|
|
30
31
|
<script setup lang="ts">
|
|
31
|
-
import { computed } from "vue";
|
|
32
|
+
import { computed, ref } from "vue";
|
|
32
33
|
const props = withDefaults(
|
|
33
34
|
defineProps<{
|
|
34
35
|
type?: string;
|
|
@@ -71,6 +72,16 @@ function keydownHandler(e: KeyboardEvent) {
|
|
|
71
72
|
}
|
|
72
73
|
}
|
|
73
74
|
}
|
|
75
|
+
|
|
76
|
+
const fieldRef = ref();
|
|
77
|
+
function focus() {
|
|
78
|
+
fieldRef.value?.focus();
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
function blur() {
|
|
82
|
+
fieldRef.value?.blur();
|
|
83
|
+
}
|
|
84
|
+
defineExpose({ fieldRef, focus, blur });
|
|
74
85
|
</script>
|
|
75
86
|
<style lang="scss">
|
|
76
87
|
.yhm-input-container {
|
package/form/yhmSelect.vue
CHANGED
|
@@ -21,9 +21,10 @@
|
|
|
21
21
|
<van-picker
|
|
22
22
|
:title="palceholder"
|
|
23
23
|
:columns="optionData"
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
@
|
|
24
|
+
:modelValue="[modelValue]"
|
|
25
|
+
ref="pickerRef"
|
|
26
|
+
@confirm="onComfirm"
|
|
27
|
+
@cancel="onCancel" />
|
|
27
28
|
</van-popup>
|
|
28
29
|
</template>
|
|
29
30
|
<script setup lang="ts">
|
|
@@ -41,7 +42,8 @@ const emits = defineEmits<{
|
|
|
41
42
|
|
|
42
43
|
const valueString = computed(() => {
|
|
43
44
|
if (props.modelValue) {
|
|
44
|
-
|
|
45
|
+
let option = props.optionData.filter((item) => item.value === props.modelValue)[0];
|
|
46
|
+
return option ? option.text : props.modelValue;
|
|
45
47
|
} else {
|
|
46
48
|
return props.palceholder || "请选择";
|
|
47
49
|
}
|
|
@@ -54,6 +56,7 @@ const valueClass = computed(() => {
|
|
|
54
56
|
});
|
|
55
57
|
|
|
56
58
|
const show = ref(false);
|
|
59
|
+
const pickerRef = ref();
|
|
57
60
|
|
|
58
61
|
function toChoose() {
|
|
59
62
|
if (props.disabled) {
|
|
@@ -62,12 +65,17 @@ function toChoose() {
|
|
|
62
65
|
show.value = true;
|
|
63
66
|
}
|
|
64
67
|
|
|
65
|
-
function onChange({ selectedValues }) {
|
|
66
|
-
|
|
67
|
-
}
|
|
68
|
+
// function onChange({ selectedValues }) {
|
|
69
|
+
// emits("update:modelValue", selectedValues[0]);
|
|
70
|
+
// }
|
|
68
71
|
function onCancel() {
|
|
69
72
|
show.value = false;
|
|
70
73
|
}
|
|
74
|
+
|
|
75
|
+
function onComfirm({ selectedValues }) {
|
|
76
|
+
emits("update:modelValue", selectedValues[0]);
|
|
77
|
+
onCancel();
|
|
78
|
+
}
|
|
71
79
|
</script>
|
|
72
80
|
<style lang="scss">
|
|
73
81
|
.yhm-datetime-container {
|
package/form/yhmSwitch.vue
CHANGED