Skip to content

Commit f0fb1f3

Browse files
authored
fix(tabs): modify the issue of the mobile demo not displaying and reporting errors (#2710)
1 parent e0a1e6f commit f0fb1f3

File tree

2 files changed

+15
-15
lines changed

2 files changed

+15
-15
lines changed

packages/mobile/components/tabs/src/renderless/index.ts

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -14,12 +14,12 @@ import type { ITabsRenderlessParams, ITabsPane, ITabsCustomEvent, ITabsPaneVm }
1414
export const calcPaneInstances =
1515
({
1616
constants,
17-
parent,
17+
vm,
1818
state,
1919
childrenHandler
20-
}: Pick<ITabsRenderlessParams, 'constants' | 'parent' | 'state' | 'childrenHandler'>) =>
20+
}: Pick<ITabsRenderlessParams, 'constants' | 'vm' | 'state' | 'childrenHandler'>) =>
2121
(isForceUpdate = false) => {
22-
const tabItemVNodes = parent.$slots.default
22+
const tabItemVNodes = vm.$slots.default
2323

2424
/* istanbul ignore if */
2525
if (tabItemVNodes) {
@@ -62,13 +62,13 @@ export const calcPaneInstances =
6262

6363
/* istanbul ignore */
6464
export const calcMorePanes =
65-
({ parent, props, state, refs }: Pick<ITabsRenderlessParams, 'parent' | 'props' | 'state' | 'refs'>) =>
65+
({ vm, props, state, refs }: Pick<ITabsRenderlessParams, 'vm' | 'props' | 'state' | 'refs'>) =>
6666
() => {
6767
if (!props.showMoreTabs) {
6868
return
6969
}
7070

71-
const el = parent.$el
71+
const el = vm.$el
7272
const tabs = el.querySelectorAll('.tiny-tabs__item')
7373
const tabNavRefs = refs.nav.$refs
7474

@@ -93,12 +93,12 @@ export const calcMorePanes =
9393
}
9494

9595
export const calcExpandPanes =
96-
({ parent, props, state }: Pick<ITabsRenderlessParams, 'parent' | 'props' | 'state'>) =>
96+
({ vm, props, state }: Pick<ITabsRenderlessParams, 'vm' | 'props' | 'state'>) =>
9797
() => {
9898
if (!props.showExpandTabs) {
9999
return
100100
}
101-
const el = parent.$el
101+
const el = vm.$el
102102
const tabsHeader = el.querySelector('.tiny-mobile-tabs__header')
103103

104104
if (tabsHeader) {
@@ -185,11 +185,11 @@ export const changeCurrentName =
185185
}
186186

187187
export const created =
188-
({ api, parent, state }: Pick<ITabsRenderlessParams, 'api' | 'parent' | 'state'>) =>
188+
({ api, vm, state }: Pick<ITabsRenderlessParams, 'api' | 'vm' | 'state'>) =>
189189
() => {
190190
api.changeDirection(state.currentName)
191191

192-
parent.$on('tab-nav-update', api.calcPaneInstances.bind(null, true))
192+
vm.$on('tab-nav-update', api.calcPaneInstances.bind(null, true))
193193
}
194194

195195
export const changeDirection =

packages/mobile/components/tabs/src/renderless/vue.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ const initWatcher = ({
102102
export const renderless = (
103103
props: ITabsProps,
104104
{ onMounted, onUpdated, provide, reactive, watch }: ISharedRenderlessParamHooks,
105-
{ refs, parent, emit, constants, nextTick, childrenHandler }: ITabsRenderlessParamUtils
105+
{ refs, parent, vm, emit, constants, nextTick, childrenHandler }: ITabsRenderlessParamUtils
106106
): ITabsApi => {
107107
const api = {} as ITabsApi
108108
const state: ITabsState = initState({ reactive, props })
@@ -113,20 +113,20 @@ export const renderless = (
113113
handleTabRemove: handleTabRemove({ emit, props }),
114114
changeDirection: changeDirection({ props, state }),
115115
changeCurrentName: changeCurrentName({ emit, state }),
116-
calcMorePanes: calcMorePanes({ parent, props, state, refs }),
117-
calcExpandPanes: calcExpandPanes({ parent, props, state }),
118-
calcPaneInstances: calcPaneInstances({ constants, parent, state, childrenHandler }),
116+
calcMorePanes: calcMorePanes({ vm, props, state, refs }),
117+
calcExpandPanes: calcExpandPanes({ vm, props, state }),
118+
calcPaneInstances: calcPaneInstances({ constants, vm, state, childrenHandler }),
119119
handleTabDragStart: handleTabDragStart({ emit }),
120120
handleTabDragOver: handleTabDragOver({ emit }),
121121
handleTabDragEnd: handleTabDragEnd({ state, emit }),
122122
handleTabClick: handleTabClick({ api, emit, props, refs }),
123123
setCurrentName: setCurrentName({ api, props, refs, state }),
124-
created: created({ api, parent, state })
124+
created: created({ api, vm, state })
125125
})
126126

127127
api.created()
128128

129-
provide('rootTabs', parent)
129+
provide('rootTabs', vm)
130130

131131
provide('separator', state.separator)
132132

0 commit comments

Comments
 (0)