UNPKG

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