@peng_kai/kit 0.2.15 → 0.2.17
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.
|
@@ -34,6 +34,10 @@ function storeSetup() {
|
|
|
34
34
|
setTimeout(() => tabKeyList.value.splice(i, 1));
|
|
35
35
|
}
|
|
36
36
|
};
|
|
37
|
+
const closeAllTab = () => {
|
|
38
|
+
tabKeyList.value.forEach(key => pageStore.closePage(key));
|
|
39
|
+
setTimeout(() => tabKeyList.value.length = 0);
|
|
40
|
+
};
|
|
37
41
|
|
|
38
42
|
watch(activeTab, (key) => {
|
|
39
43
|
if (!tabKeyList.value.includes(key))
|
|
@@ -43,6 +47,7 @@ function storeSetup() {
|
|
|
43
47
|
return {
|
|
44
48
|
activeTab,
|
|
45
49
|
tabList,
|
|
50
|
+
closeAllTab,
|
|
46
51
|
closeTab,
|
|
47
52
|
openTab,
|
|
48
53
|
};
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
|
-
import { computed } from 'vue';
|
|
2
|
+
import { computed, nextTick, watch } from 'vue';
|
|
3
3
|
import { InputNumber as AInputNumber, Form } from 'ant-design-vue';
|
|
4
|
+
import { isNil } from 'lodash-es';
|
|
4
5
|
</script>
|
|
5
6
|
|
|
6
7
|
<script setup lang="ts">
|
|
@@ -22,25 +23,22 @@ const emits = defineEmits<{
|
|
|
22
23
|
|
|
23
24
|
const formItemContext = Form.useInjectFormItemContext();
|
|
24
25
|
const minValue = computed({
|
|
25
|
-
get()
|
|
26
|
-
|
|
27
|
-
},
|
|
28
|
-
set(value) {
|
|
29
|
-
updateValue(value, maxValue.value);
|
|
30
|
-
},
|
|
26
|
+
get: () => props.value[0],
|
|
27
|
+
set: v => emits('update:value', [v, props.value[1]]),
|
|
31
28
|
});
|
|
32
29
|
const maxValue = computed({
|
|
33
|
-
get()
|
|
34
|
-
|
|
35
|
-
},
|
|
36
|
-
set(value) {
|
|
37
|
-
updateValue(minValue.value, value);
|
|
38
|
-
},
|
|
30
|
+
get: () => props.value[1],
|
|
31
|
+
set: v => emits('update:value', [props.value[0], v]),
|
|
39
32
|
});
|
|
40
33
|
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
34
|
+
watch([minValue, maxValue], () => formItemContext.onFieldChange());
|
|
35
|
+
|
|
36
|
+
function onBlur() {
|
|
37
|
+
const min = props.value[0];
|
|
38
|
+
const max = props.value[1];
|
|
39
|
+
|
|
40
|
+
if (!isNil(min) && !isNil(max))
|
|
41
|
+
emits('update:value', [min, max].sort() as [number, number]);
|
|
44
42
|
}
|
|
45
43
|
</script>
|
|
46
44
|
|
|
@@ -49,11 +47,13 @@ function updateValue(...args: typeof props.value) {
|
|
|
49
47
|
<AInputNumber
|
|
50
48
|
v-model:value="minValue" class="w-full" :min="props.min"
|
|
51
49
|
:max="props.max" :placeholder="props.placeholder?.[0]"
|
|
50
|
+
@blur="onBlur"
|
|
52
51
|
/>
|
|
53
52
|
<span> - </span>
|
|
54
53
|
<AInputNumber
|
|
55
54
|
v-model:value="maxValue" class="w-full" :min="props.min"
|
|
56
55
|
:max="props.max" :placeholder="props.placeholder?.[1]"
|
|
56
|
+
@blur="onBlur"
|
|
57
57
|
/>
|
|
58
58
|
</div>
|
|
59
59
|
</template>
|