diff --git a/packages/vant/src/dropdown-item/DropdownItem.tsx b/packages/vant/src/dropdown-item/DropdownItem.tsx index 58efef1d2..fd210535c 100644 --- a/packages/vant/src/dropdown-item/DropdownItem.tsx +++ b/packages/vant/src/dropdown-item/DropdownItem.tsx @@ -58,7 +58,7 @@ export default defineComponent({ showWrapper: false, }); - const { parent } = useParent(DROPDOWN_KEY); + const { parent, index } = useParent(DROPDOWN_KEY); if (!parent) { if (process.env.NODE_ENV !== 'production') { @@ -142,14 +142,16 @@ export default defineComponent({ return ( + /> ); }; @@ -175,12 +177,14 @@ export default defineComponent({ > (); const barRef = ref(); const offset = ref(0); @@ -115,6 +117,7 @@ export default defineComponent({ return (
-
@@ -14,7 +15,8 @@ exports[`should render demo and match snapshot 1`] = `
-
@@ -46,7 +48,8 @@ exports[`should render demo and match snapshot 1`] = `
-
@@ -56,7 +59,8 @@ exports[`should render demo and match snapshot 1`] = `
-
@@ -88,7 +92,8 @@ exports[`should render demo and match snapshot 1`] = `
-
@@ -98,7 +103,8 @@ exports[`should render demo and match snapshot 1`] = `
-
@@ -130,7 +136,8 @@ exports[`should render demo and match snapshot 1`] = `
-
@@ -140,7 +147,8 @@ exports[`should render demo and match snapshot 1`] = `
-
@@ -172,7 +180,8 @@ exports[`should render demo and match snapshot 1`] = `
-
@@ -181,7 +190,8 @@ exports[`should render demo and match snapshot 1`] = `
-
diff --git a/packages/vant/src/dropdown-menu/test/__snapshots__/index.spec.tsx.snap b/packages/vant/src/dropdown-menu/test/__snapshots__/index.spec.tsx.snap index 378b4696c..44c7a79d5 100644 --- a/packages/vant/src/dropdown-menu/test/__snapshots__/index.spec.tsx.snap +++ b/packages/vant/src/dropdown-menu/test/__snapshots__/index.spec.tsx.snap @@ -3,7 +3,8 @@ exports[`click option 1`] = `
-
@@ -13,7 +14,8 @@ exports[`click option 1`] = `
-
@@ -36,9 +38,11 @@ exports[`click option 1`] = `