vue2server7 7.0.4 → 7.0.5
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
|
Binary file
|
package/test/319
DELETED
|
@@ -1,41 +0,0 @@
|
|
|
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>
|
package/test/320
DELETED
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
interface TreeNode {
|
|
2
|
-
value: string | number
|
|
3
|
-
label: string
|
|
4
|
-
children?: TreeNode[]
|
|
5
|
-
}
|
|
6
|
-
|
|
7
|
-
function findLabelByValue(
|
|
8
|
-
list: TreeNode[],
|
|
9
|
-
targetValue: string | number
|
|
10
|
-
): string | null {
|
|
11
|
-
for (const item of list) {
|
|
12
|
-
// 当前节点命中
|
|
13
|
-
if (item.value === targetValue) {
|
|
14
|
-
return item.label
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
// 递归子节点
|
|
18
|
-
if (item.children && item.children.length) {
|
|
19
|
-
const result = findLabelByValue(item.children, targetValue)
|
|
20
|
-
if (result) return result
|
|
21
|
-
}
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
return null
|
|
25
|
-
}
|