EEUI.APP
首页
文档
- 指南
- 组件
- 模块
插件
- 插件市场
- 开发文档
热更新
控制台
Editor
例子
社区
APP进入后台、APP进入前台、页面挂载、页面激活、页面失活、页面停止。
### # 生命周期钩子 Vue 组件的实例生命周期钩子将在特定的阶段发出,详情请参考 Vue 组件的生命周期图示。
<template>…</template><script>export default {beforeCreate: function (){console.log('beforeCreate');},created: function () {console.log('created');},beforeMount: function () {console.log('beforeMount');},mounted: function () {console.log('mounted');},beforeUpdate: function () {console.log('beforeUpdate');},updated: function () {console.log('updated');},beforeDestroy: function () {console.log('beforeDestroy');},destroyed: function () {console.log('destroyed');},appActive: function (data) {console.log('APP进入前台:App从【后台】切换至【前台】时触发');},appDeactive: function (data) {console.log('APP进入后台:App从【前台】切换至【后台】时触发');},pageReady: function (data) {console.log('页面挂载:页面【渲染完成】时触发');},pageResume: function (data) {console.log('页面激活:页面【恢复】时触发(渲染完成时也会触发1次)');},pagePause: function (data) {console.log('页面失活:页面【暂停】时触发');},pageDestroy: function (data) {console.log('页面停止:页面【销毁】时触发');}}</script>
| Vue 生命周期钩子 | 是否支持 | 说明 |
|---|---|---|
| beforeCreate | 支持 | - |
| created | 支持 | - |
| beforeMount | 支持 | - |
| mounted | 支持 | 详见下文解释 |
| beforeUpdate | 支持 | - |
| updated | 支持 | - |
| activated | 不支持 | 不支持 |
| deactivated | 不支持 | 不支持 |
| beforeDestroy | 支持 | - |
| destroyed | 支持 | - |
| errorCaptured | 支持 | - |
以下是eeui特有: | ||
| appActive | 支持 | APP进入前台:App从【后台】切换至【前台】时触发 |
| appDeactive | 支持 | APP进入后台:App从【前台】切换至【后台】时触发 |
| pageReady | 支持 | 页面挂载:页面【渲染完成】时触发 |
| pageResume | 支持 | 页面激活:页面【恢复】时触发(渲染完成时也会触发1次) |
| pagePause | 支持 | 页面失活:页面【暂停】时触发 |
| pageDestroy | 支持 | 页面停止:页面【销毁】时触发 |
mounted 生命周期在当前组件的 virtual-dom (Vue 里的 VNode) 构建完成后就会触发,此时相应的原生视图未必已经渲染完成。
在 GitHub 上编辑此页
最后一次更新: 7/24/2020, 11:56:07 PM
