From 7f0ba1dc1af92239bcb3bf8dec0cc766985f1ebd Mon Sep 17 00:00:00 2001 From: baosiqing Date: Thu, 8 Sep 2022 17:15:57 +0800 Subject: [PATCH] feat(h5): swiper component add props type, full and zoom --- packages/taro-components/types/Swiper.d.ts | 12 ++++++++++++ packages/taro-h5/src/api/media/image/previewImage.ts | 3 ++- 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/packages/taro-components/types/Swiper.d.ts b/packages/taro-components/types/Swiper.d.ts index 621781353c19..92e3253c8078 100644 --- a/packages/taro-components/types/Swiper.d.ts +++ b/packages/taro-components/types/Swiper.d.ts @@ -103,6 +103,18 @@ interface SwiperProps extends StandardProps { */ disableTouch?: boolean + /** 是否启用缩放 + * @default false + * @supported h5 + */ + zoom?: boolean + + /** 是否开启全屏 + * @default false + * @supported h5 + */ + full?: boolean + /** swiper-item 可见时的 class。 * @supported alipay */ diff --git a/packages/taro-h5/src/api/media/image/previewImage.ts b/packages/taro-h5/src/api/media/image/previewImage.ts index 8de6aef50297..06902348a8ab 100644 --- a/packages/taro-h5/src/api/media/image/previewImage.ts +++ b/packages/taro-h5/src/api/media/image/previewImage.ts @@ -1,4 +1,5 @@ import Taro from '@tarojs/api' +import { SwiperProps } from '@tarojs/components' import { shouldBeObject } from '../../../utils' import { MethodHandler } from '../../../utils/handler' @@ -50,7 +51,7 @@ export const previewImage: typeof Taro.previewImage = async (options) => { container.remove() }) - const swiper = document.createElement('taro-swiper-core') + const swiper: HTMLElement & Omit = document.createElement('taro-swiper-core') // @ts-ignore swiper.full = true // @ts-ignore