Container
Container.
After the container component is set to visible to true for the first time, the internal components are cached. Avoid duplicate rendering of pages and keep internal component states updated.
Example
js
Page({
data: {
visible: false,
},
toggle() {
this.setData({
visible: !this.data.visible
})
},
})
bxml
<theme-context>
<view class='container'>
<head title='Container'></head>
<view class='page-body'>
<container visible="{{visible}}">
<view>your page A</view>
</container>
<container visible="{{!visible}}">
<view>your page B</view>
</container>
<button ontap="toggle">toggle visible</button>
</view>
</view>
</theme-context>
Props
Name | Type | Description | Default |
---|---|---|---|
visible | boolean | false |