From dff7e83e0ad354bd5727668e302156447e3f8403 Mon Sep 17 00:00:00 2001 From: MrWang2016 <421231576@qq.com> Date: Sat, 10 Jun 2023 15:56:52 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E4=BF=AE=E5=A4=8DactionSheet=E7=BB=84?= =?UTF-8?q?=E4=BB=B6api.watchVisible=E7=A9=BA=E6=8C=87=E9=92=88=E9=97=AE?= =?UTF-8?q?=E9=A2=98=E5=92=8C=E5=8E=BB=E6=8E=89tabs=E7=A9=BA=E7=99=BDpaddi?= =?UTF-8?q?ng=20(#278)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * 修复actionSheet在手机上click无效问题 * 修复pullRefresh组件,数据类型不匹配,导致控制台告警日志超大量打印,导致页面渲染慢的问题 * 修复actionSheet组件api.watchVisible空指针问题和去掉tabs空白padding --- packages/renderless/src/action-sheet/index.ts | 2 +- packages/renderless/src/action-sheet/vue.ts | 26 +++++++++---------- packages/theme-mobile/src/tabs/index.less | 1 - packages/vue/src/pull-refresh/src/mobile.vue | 6 +++-- 4 files changed, 18 insertions(+), 17 deletions(-) diff --git a/packages/renderless/src/action-sheet/index.ts b/packages/renderless/src/action-sheet/index.ts index ed75b2db9..45ff885ae 100644 --- a/packages/renderless/src/action-sheet/index.ts +++ b/packages/renderless/src/action-sheet/index.ts @@ -37,7 +37,7 @@ export const setSheetStyle = ({ state, props }) => () => { export const initScrollMenu = ({ state, nextTick, refs, BScroll }) => () => { nextTick(() => { const { scrollMenu } = refs - if (state.scroll) { + if (!state.scroll) { state.scroll = new BScroll(scrollMenu, { probeType: 3, tap: 'tap' diff --git a/packages/renderless/src/action-sheet/vue.ts b/packages/renderless/src/action-sheet/vue.ts index 70875c5ea..7864f8925 100644 --- a/packages/renderless/src/action-sheet/vue.ts +++ b/packages/renderless/src/action-sheet/vue.ts @@ -12,7 +12,7 @@ import { setSheetStyle, initScrollMenu, visibleHandle, watchVisible, menuHandle, close, selectOption, confirm, actionSelectOption, hide } from './index' -export const api = ['state', 'setSheetStyle', 'initScrollMenu', 'visibleHandle', 'menuHandle', 'close', 'selectOption', 'confirm', 'actionSelectOption', 'hide'] +export const api = ['state', 'setSheetStyle', 'initScrollMenu', 'visibleHandle', 'watchVisible', 'menuHandle', 'close', 'selectOption', 'confirm', 'actionSelectOption', 'hide'] export const renderless = (props, { reactive, watch }, { emit, nextTick, refs, vm }, { BScroll }) => { const api = {} @@ -24,18 +24,6 @@ export const renderless = (props, { reactive, watch }, { emit, nextTick, refs, v scroll: null, }) - watch(() => props.visible, - (value) => { - if (value) { - api.setSheetStyle({ state, props }) - api.initScrollMenu({ state, nextTick, refs, BScroll }) - } - api.watchVisible(value) - }, - ) - - watch(() => props.visible, api.watchVisible, { immediate: true }) - Object.assign(api, { state, setSheetStyle: setSheetStyle({ state, props }), @@ -50,5 +38,17 @@ export const renderless = (props, { reactive, watch }, { emit, nextTick, refs, v hide: hide(emit) }) + watch(() => props.visible, + (value) => { + if (value) { + api.setSheetStyle({ state, props }) + api.initScrollMenu({ state, nextTick, refs, BScroll }) + } + api.watchVisible(value) + }, + ) + + watch(() => props.visible, api.watchVisible, { immediate: true }) + return api } diff --git a/packages/theme-mobile/src/tabs/index.less b/packages/theme-mobile/src/tabs/index.less index 389d4a87c..ee60361ca 100644 --- a/packages/theme-mobile/src/tabs/index.less +++ b/packages/theme-mobile/src/tabs/index.less @@ -31,7 +31,6 @@ font-size: var(--ti-mobile-tabs-font-size, 14px); color: var(--ti-mobile-tabs-text-color, #333); background: var(--ti-mobile-tabs-bg-color, #fff); - padding: 15px 24px; } &__new-tab { diff --git a/packages/vue/src/pull-refresh/src/mobile.vue b/packages/vue/src/pull-refresh/src/mobile.vue index 460bf46bc..5452a43c2 100644 --- a/packages/vue/src/pull-refresh/src/mobile.vue +++ b/packages/vue/src/pull-refresh/src/mobile.vue @@ -79,10 +79,12 @@ export default defineComponent({ default: false }, pullUp: { - type: Object + type: Object, + default: {} }, pullDown: { - type: Object + type: Object, + default: {} }, hasMore: { type: Boolean,