Skip to content

Commit

Permalink
feat(h5): swiper component add props type, full and zoom
Browse files Browse the repository at this point in the history
  • Loading branch information
baosiqing authored and ZakaryCode committed Nov 29, 2022
1 parent c892616 commit 7f0ba1d
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 1 deletion.
12 changes: 12 additions & 0 deletions packages/taro-components/types/Swiper.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
*/
Expand Down
3 changes: 2 additions & 1 deletion packages/taro-h5/src/api/media/image/previewImage.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import Taro from '@tarojs/api'
import { SwiperProps } from '@tarojs/components'

import { shouldBeObject } from '../../../utils'
import { MethodHandler } from '../../../utils/handler'
Expand Down Expand Up @@ -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<SwiperProps, 'style' | 'children'> = document.createElement('taro-swiper-core')
// @ts-ignore
swiper.full = true
// @ts-ignore
Expand Down

0 comments on commit 7f0ba1d

Please sign in to comment.