Skip to content
This repository has been archived by the owner on Feb 2, 2024. It is now read-only.

fix(dropdown-mobile): 修复移动端组件dropdownMenu无法正常渲染的问题,顺带修复pc端dropDown组件的警告 #35

Merged
merged 1 commit into from
Mar 22, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion src/dropdown-item/vue.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 })
Expand Down
5 changes: 3 additions & 2 deletions src/dropdown-menu/vue.js
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -27,6 +27,7 @@ export const renderless = (props, hooks, instance) => {
})

if (mode === 'mobile') {
provide('dropdownMenu', vm)
nextTick(() => {
state.scroller = getScroller(refs.menu)
})
Expand Down