-
-
-
Please select
-
- -
-
a1
-
- -
-
b2
-
- -
-
-
-
-
-
+
`;
@@ -296,19 +241,11 @@ exports[`renders ./antdv-demo/docs/select/demo/suffix.md correctly 1`] = `
`;
exports[`renders ./antdv-demo/docs/select/demo/tags.md correctly 1`] = `
-
-
-
+
`;
diff --git a/components/select/__tests__/__snapshots__/index.test.js.snap b/components/select/__tests__/__snapshots__/index.test.js.snap
index 610fcd941..c8605100b 100644
--- a/components/select/__tests__/__snapshots__/index.test.js.snap
+++ b/components/select/__tests__/__snapshots__/index.test.js.snap
@@ -10,5 +10,3 @@ exports[`Select Select Custom Icons should support customized icons 1`] = `
`;
-
-exports[`Select should not have notFoundContent when mode is combobox and notFoundContent is set 1`] = `"not at all"`;
diff --git a/components/vc-select/Selector/Input.tsx b/components/vc-select/Selector/Input.tsx
index aa0cc670a..a448d8ff7 100644
--- a/components/vc-select/Selector/Input.tsx
+++ b/components/vc-select/Selector/Input.tsx
@@ -1,5 +1,13 @@
import { cloneElement } from '../../_util/vnode';
-import { defineComponent, inject, VNode, VNodeChild, withDirectives } from 'vue';
+import {
+ defineComponent,
+ getCurrentInstance,
+ inject,
+ onMounted,
+ VNode,
+ VNodeChild,
+ withDirectives,
+} from 'vue';
import PropTypes from '../../_util/vue-types';
import { RefObject } from '../../_util/createRef';
import antInput from '../../_util/antInputDirective';
@@ -30,7 +38,17 @@ interface InputProps {
const Input = defineComponent
({
name: 'Input',
inheritAttrs: false,
- setup() {
+ setup(props) {
+ if (process.env.NODE_ENV === 'test') {
+ onMounted(() => {
+ const ins = getCurrentInstance();
+ if (props.autofocus) {
+ if (ins.vnode && ins.vnode.el) {
+ ins.vnode.el.focus();
+ }
+ }
+ });
+ }
return {
VCSelectContainerEvent: inject('VCSelectContainerEvent'),
};
diff --git a/components/vc-select/generate.tsx b/components/vc-select/generate.tsx
index e424a2822..884705041 100644
--- a/components/vc-select/generate.tsx
+++ b/components/vc-select/generate.tsx
@@ -660,21 +660,18 @@ export default function generateSelector<
};
// ============================== Open ==============================
-
- const innerOpen = ref(undefined);
- const mergedOpen = ref(undefined);
+ const initOpen = props.open !== undefined ? props.open : props.defaultOpen;
+ const innerOpen = ref(initOpen);
+ const mergedOpen = ref(initOpen);
const setInnerOpen = (val: boolean) => {
- setTimeout(() => {
- innerOpen.value = val;
- mergedOpen.value = innerOpen.value;
- });
+ innerOpen.value = props.open !== undefined ? props.open : val;
+ mergedOpen.value = innerOpen.value;
};
watch(
- computed(() => [props.defaultOpen, props.open]),
+ () => props.open,
() => {
- setInnerOpen(props.open !== undefined ? props.open : props.defaultOpen);
+ setInnerOpen(props.open);
},
- { immediate: true },
);
// Not trigger `open` in `combobox` when `notFoundContent` is empty