stellar-ui-plus 1.23.1 → 1.23.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.
|
@@ -244,6 +244,18 @@
|
|
|
244
244
|
<script setup lang="ts">
|
|
245
245
|
import { ref } from 'vue';
|
|
246
246
|
const value7 = ref('');
|
|
247
|
+
// 控制最大值为100
|
|
248
|
+
watch(
|
|
249
|
+
() => value7.value,
|
|
250
|
+
v => {
|
|
251
|
+
// 必须在下一帧执行,否则会因为数据未更新而报错
|
|
252
|
+
nextTick(() => {
|
|
253
|
+
if (Number(v) > 100) {
|
|
254
|
+
value7.value = '100';
|
|
255
|
+
}
|
|
256
|
+
});
|
|
257
|
+
}
|
|
258
|
+
);
|
|
247
259
|
</script>
|
|
248
260
|
<style lang="scss" scoped>
|
|
249
261
|
.test-input {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { computed, ref, watch } from 'vue';
|
|
1
|
+
import { computed, nextTick, ref, watch } from 'vue';
|
|
2
2
|
import utils from '../../utils/utils';
|
|
3
3
|
import { useColorStore } from '../../store/color';
|
|
4
4
|
import type { NumberKeyboardProps } from './props';
|
|
@@ -31,8 +31,16 @@ export default function useData({
|
|
|
31
31
|
if (value === null || value === undefined) dataValue.value = '';
|
|
32
32
|
else if (typeof value === 'string') dataValue.value = value;
|
|
33
33
|
else dataValue.value = String(value);
|
|
34
|
+
|
|
34
35
|
};
|
|
35
36
|
|
|
37
|
+
watch(() => dataValue.value, (v) => {
|
|
38
|
+
nextTick(() => {
|
|
39
|
+
emits('update:modelValue', v);
|
|
40
|
+
emits('change', v);
|
|
41
|
+
})
|
|
42
|
+
}, { immediate: true });
|
|
43
|
+
|
|
36
44
|
const dataShow = ref(false);
|
|
37
45
|
const setDataShow = (value: boolean) => {
|
|
38
46
|
if (value === dataShow.value) return;
|
|
@@ -131,8 +139,7 @@ export default function useData({
|
|
|
131
139
|
break;
|
|
132
140
|
}
|
|
133
141
|
emits('input', dataValue.value);
|
|
134
|
-
|
|
135
|
-
emits('update:modelValue', dataValue.value);
|
|
142
|
+
|
|
136
143
|
|
|
137
144
|
if (props.activeInputRef) {
|
|
138
145
|
const values = props.inputValues;
|