vue2server7 6.0.0 → 7.0.1
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
package/test/319
ADDED
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<el-input
|
|
3
|
+
v-model="innerValue"
|
|
4
|
+
@input="handleInput"
|
|
5
|
+
v-bind="$attrs"
|
|
6
|
+
/>
|
|
7
|
+
</template>
|
|
8
|
+
|
|
9
|
+
<script setup lang="ts">
|
|
10
|
+
import { ref, watch } from 'vue'
|
|
11
|
+
|
|
12
|
+
// ✅ props 类型
|
|
13
|
+
interface Props {
|
|
14
|
+
modelValue?: string
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
const props = defineProps<Props>()
|
|
18
|
+
|
|
19
|
+
// ✅ emit 类型
|
|
20
|
+
const emit = defineEmits<{
|
|
21
|
+
(e: 'update:modelValue', value: string): void
|
|
22
|
+
}>()
|
|
23
|
+
|
|
24
|
+
// ✅ 内部值
|
|
25
|
+
const innerValue = ref<string>(props.modelValue ?? '')
|
|
26
|
+
|
|
27
|
+
// ✅ 监听外部变化
|
|
28
|
+
watch(
|
|
29
|
+
() => props.modelValue,
|
|
30
|
+
(val) => {
|
|
31
|
+
innerValue.value = val ?? ''
|
|
32
|
+
}
|
|
33
|
+
)
|
|
34
|
+
|
|
35
|
+
// ✅ 输入处理
|
|
36
|
+
const handleInput = (val: string) => {
|
|
37
|
+
const newVal = val.replace(/[^\d]/g, '')
|
|
38
|
+
innerValue.value = newVal
|
|
39
|
+
emit('update:modelValue', newVal)
|
|
40
|
+
}
|
|
41
|
+
</script>
|
|
Binary file
|
package/test/docs.zip
DELETED
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|