Skip to content

Commit

Permalink
fix(weapp): 补全微信小程序 PageContainer 组件的类型,fix #9182
Browse files Browse the repository at this point in the history
  • Loading branch information
Chen-jj committed Apr 25, 2021
1 parent 67af8b3 commit 81ebacf
Show file tree
Hide file tree
Showing 2 changed files with 84 additions and 0 deletions.
2 changes: 2 additions & 0 deletions packages/taro-cli/templates/default/global.d.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
/// <reference path="node_modules/@tarojs/plugin-platform-weapp/types/shims-weapp.d.ts" />

declare module '*.png';
declare module '*.gif';
declare module '*.jpg';
Expand Down
82 changes: 82 additions & 0 deletions packages/taro-weapp/types/shims-weapp.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
import { ComponentType } from 'react'
import { StandardProps } from '@tarojs/components'

interface PageContainerProps extends StandardProps {
/**
* @description 是否显示容器组件
* @default false
*/
show?: boolean

/**
* @description 动画时长,单位毫秒
* @default 300
*/
duration?: number


/**
* @description z-index 层级
* @default 300
*/
zIndex?: number

/**
* @description 是否显示遮罩层
* @default true
*/
overlay?: boolean

/**
* @description 弹出位置,可选值为 top bottom right center
* @default 'bottom'
*/
position?: PageContainerProps.position

/**
* @description 是否显示圆角
* @default false
*/
round?: boolean

/**
* @description 是否在下滑一段距离后关闭
* @default false
*/
closeOnSlideDown?: boolean

/** @description 自定义遮罩层样式 */
overlayStyle?: string


/** @description 自定义弹出层样式 */
customStyle?: string

/** @description 进入前触发 */
onBeforeEnter?: () => void
/** @description 进入中触发 */
onEnter?: () => void
/** @description 进入后触发 */
onAfterEnter?: () => void
/** @description 离开前触发 */
onBeforeLeave?: () => void
/** @description 离开中触发 */
onLeave?: () => void
/** @description 离开后触发 */
onAfterLeave?: () => void
/** @description 点击遮罩层时触发 */
onClickOverlay?: () => void
}

declare namespace PageContainerProps {
type position = 'top' | 'bottom' | 'right' | 'center'
}

declare module '@tarojs/components' {
/** 页面容器
* @classification PageContainer
* @supported weapp
* @see https://developers.weixin.qq.com/miniprogram/dev/component/page-container.html
*/
export const PageContainer: ComponentType<PageContainerProps>
}

0 comments on commit 81ebacf

Please sign in to comment.