UNPKG

2.75 kBTypeScriptView Raw
1import { ComponentType } from 'react'
2import { StandardProps, CommonEventFunction } from './common'
3
4interface PageMetaProps extends StandardProps {
5 /** 下拉背景字体、loading 图的样式,仅支持 dark 和 light
6 * @supported weapp
7 */
8 backgroundTextStyle?: string
9
10 /** 窗口的背景色,必须为十六进制颜色值
11 * @supported weapp
12 */
13 backgroundColor?: string
14
15 /** 顶部窗口的背景色,必须为十六进制颜色值,仅 iOS 支持
16 * @supported weapp
17 */
18 backgroundColorTop?: string
19
20 /** 底部窗口的背景色,必须为十六进制颜色值,仅 iOS 支持
21 * @supported weapp
22 */
23 backgroundColorBottom?: string
24
25 /** 滚动位置,可以使用 px 或者 rpx 为单位,在被设置时,页面会滚动到对应位置
26 * @default ""
27 * @supported weapp
28 */
29 scrollTop?: string
30
31 /** 滚动动画时长
32 * @default 300
33 * @supported weapp
34 */
35 scrollDuration?: number
36
37 /** 页面根节点样式,页面根节点是所有页面节点的祖先节点,相当于 HTML 中的 body 节点
38 * @default ""
39 * @supported weapp
40 */
41 pageStyle?: string
42
43 /** 页面的根字体大小,页面中的所有 rem 单位,将使用这个字体大小作为参考值,即 1rem 等于这个字体大小
44 * @default ""
45 * @supported weapp
46 */
47 rootFontSize?: string
48
49 /** 页面尺寸变化时会触发 resize 事件,event.detail = { size: { windowWidth, windowHeight } }
50 * @supported weapp
51 */
52 onResize?: CommonEventFunction<PageMetaProps.onResizeEventDetail>
53
54 /** 页面滚动时会触发 scroll 事件,event.detail = { scrollTop }
55 * @supported weapp
56 */
57 onScroll?: CommonEventFunction<PageMetaProps.onScrollEventDetail>
58
59 /** 如果通过改变 scroll-top 属性来使页面滚动,页面滚动结束后会触发 scrolldone 事件
60 * @supported weapp
61 */
62 onScrollDone?: CommonEventFunction
63}
64
65declare namespace PageMetaProps {
66 interface onResizeEventDetail {
67 /** 窗口尺寸 */
68 size: resizeType
69 }
70 /** 窗口尺寸类型 */
71 interface resizeType {
72 /** 窗口宽度 */
73 windowWidth: number
74 /** 窗口高度 */
75 windowHeight: number
76 }
77 interface onScrollEventDetail {
78 scrollTop: number
79 }
80}
81
82/** 页面属性配置节点,用于指定页面的一些属性、监听页面事件。只能是页面内的第一个节点。可以配合 navigation-bar 组件一同使用。
83 * 通过这个节点可以获得类似于调用 Taro.setBackgroundTextStyle Taro.setBackgroundColor 等接口调用的效果。
84 * @supported weapp
85 * @see https://developers.weixin.qq.com/miniprogram/dev/component/page-meta.html
86 */
87declare const PageMeta: ComponentType<PageMetaProps>
88
89export { PageMeta, PageMetaProps }