May 18, 2021 WeChat Mini Program Development Document
Base library 2.9.0 starts to support, and low versions need to be compatible.
Page properties configure nodes to specify some properties of a page and listen for page events. C an only be the first node within the page. Can be used with navigation-bar components.
This node gives the effect of calling interfaces such as wx.setBackgroundTextStyle wx.setBackgroundColor.
Property | Type | The default | Required | Description | The lowest version |
---|---|---|---|---|---|
background-text-style | string | Whether |
Pull down the background font, the style of the loading diagram, and only
dark
and
light
|
2.9.0 | |
background-color | string | Whether | The background color of the window, which must be a hete size color value | 2.9.0 | |
background-color-top | string | Whether | The background color of the top window must be a heteen color value, supported only by iOS | 2.9.0 | |
background-color-bottom | string | Whether | The background color of the bottom window, which must be a hete size color value, is supported only by iOS | 2.9.0 | |
scroll-top | string | "" | Whether | Scrolling positions, which can be in px or rpx units, scroll the page to the corresponding location when set | 2.9.0 |
scroll-duration | number | 300 | Whether | Scroll the length of the animation | 2.9.0 |
page-style | string | "" | Whether | Page root node style, page root node is the ancestor node of all page nodes, equivalent to the body node in HTML | 2.9.0 |
body-font-size | string | "" | Whether |
The font size of the page page, which can be
system
represents the WeChat font size set by the current user
|
2.11.0 |
root-font-size | string | "" | Whether |
The root font size of the page, all rem units on the page, will use this font size as a reference
1rem
equals
system
or it can be set to system since the little program version 2.11.0
|
2.9.0 |
bindresize | eventhandle | Whether |
The resize event is triggered when the page size
resize
and event.detail is s
event.detail = { size: { windowWidth, windowHeight } }
|
2.9.0 | |
bindscroll | eventhandle | Whether |
The scroll event is triggered when the
scroll
scrolls,
event.detail = { scrollTop }
|
2.9.0 | |
bindscrolldone | eventhandle | Whether |
If you scroll the
scroll-top
property, the
scrolldone
event is triggered when the page scrolls
|
2.9.0 |
<page-meta
background-text-style="{{bgTextStyle}}"
background-color="{{bgColor}}"
background-color-top="{{bgColorTop}}"
background-color-bottom="{{bgColorBottom}}"
scroll-top="{{scrollTop}}"
page-style="color: green"
root-font-size="16px"
>
<navigation-bar
title="{{nbTitle}}"
loading="{{nbLoading}}"
front-color="{{nbFrontColor}}"
background-color="{{nbBackgroundColor}}"
/>
</page-meta>
Page({
data: {
bgTextStyle: 'dark',
scrollTop: '200rpx',
bgColor: '#ff0000',
bgColorTop: '#00ff00',
bgColorBottom: '#0000ff',
nbTitle: '标题',
nbLoading: false,
nbFrontColor: '#000000',
nbBackgroundColor: '#ffffff',
},
})