From 0d0be095680434c6a7398e935c199cd20f95997c Mon Sep 17 00:00:00 2001
From: chenxi-20 <2465950588@qq.com>
Date: Mon, 20 Mar 2023 17:42:35 +0800
Subject: [PATCH] =?UTF-8?q?fix(dropdown-mobile):=20=E4=BF=AE=E5=A4=8D?=
 =?UTF-8?q?=E7=A7=BB=E5=8A=A8=E7=AB=AF=E7=BB=84=E4=BB=B6dropdownMenu?=
 =?UTF-8?q?=E6=97=A0=E6=B3=95=E6=AD=A3=E5=B8=B8=E6=B8=B2=E6=9F=93=E7=9A=84?=
 =?UTF-8?q?=E9=97=AE=E9=A2=98=EF=BC=8C=E9=A1=BA=E5=B8=A6=E4=BF=AE=E5=A4=8D?=
 =?UTF-8?q?pc=E7=AB=AFdropDown=E7=BB=84=E4=BB=B6=E7=9A=84=E8=AD=A6?=
 =?UTF-8?q?=E5=91=8A?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

---
 src/dropdown-item/vue.js | 5 ++++-
 src/dropdown-menu/vue.js | 5 +++--
 2 files changed, 7 insertions(+), 3 deletions(-)

diff --git a/src/dropdown-item/vue.js b/src/dropdown-item/vue.js
index 5e13238..dfa8438 100644
--- a/src/dropdown-item/vue.js
+++ b/src/dropdown-item/vue.js
@@ -93,10 +93,13 @@ const initApi = ({ api, state, emit, props, parent, dispatch, vm }) => {
   })
 }
 
-export const renderless = (props, { computed, reactive, watch, inject }, { parent, emit, vm, dispatch }) => {
+export const renderless = (props, { computed, reactive, watch, inject }, { parent, emit, vm, dispatch, mode }) => {
   const api = {}
   const dropdownMenu = inject('dropdownMenu', null)
 
+  if (mode === 'mobile') {
+    dropdownMenu.state.children = [...dropdownMenu.state.children, vm]
+  }
   parent = parent.$parent
 
   const state = initState({ reactive, computed, api, props, parent, dropdownMenu })
diff --git a/src/dropdown-menu/vue.js b/src/dropdown-menu/vue.js
index 44b04bd..00e20f7 100644
--- a/src/dropdown-menu/vue.js
+++ b/src/dropdown-menu/vue.js
@@ -16,8 +16,8 @@ export const api = ['state', 'toggleItem', 'updateOffset', 'clickOutside', 'doDe
 
 export const renderless = (props, hooks, instance) => {
   const api = {}
-  const { reactive } = hooks
-  const { refs, nextTick, mode } = instance
+  const { reactive, provide } = hooks
+  const { refs, nextTick, mode, vm } = instance
   const state = reactive({
     offset: 0,
     scroller: null,
@@ -27,6 +27,7 @@ export const renderless = (props, hooks, instance) => {
   })
 
   if (mode === 'mobile') {
+    provide('dropdownMenu', vm)
     nextTick(() => {
       state.scroller = getScroller(refs.menu)
     })