配置文件
{"module": {"requestPermissions": [ //权限{"name": "ohos.permission.EXECUTE_INSIGHT_INTENT"}],"name": "entry", //模块的名称"type": "entry", //模块类型 :ability类型和(shared)library类型 ,ability类型又分为entry类型和 feature 功能类型的"description": "$string:module_desc","mainElement": "EntryAbility", //应用组件的一个入口,就是entryability下的EntryAbility.ets文件"deviceTypes": [ //指定模块的运行设备,这里是手机和平板"phone","tablet"],"deliveryWithInstall": true, //是否必须得安装,比如有些feature类型可以不用安装"installationFree": false,"pages": "$profile:main_pages", //当前模块下所有的页面路由"abilities": [ //一个模块下可以创建多个abiliy,都得配置{"name": "EntryAbility","srcEntry": "./ets/entryability/EntryAbility.ets","description": "$string:EntryAbility_desc","icon": "$media:layered_image", //应用桌面的图标"label": "$string:EntryAbility_label", //应用桌面的名字"startWindowIcon": "$media:startIcon","startWindowBackground": "$color:start_window_background","launchType": "singleton", //模块的启动模式"exported": true,"skills": [ //ability的能力{"entities": ["entity.system.home" //标明入口组件],"actions": ["action.system.home"]}]}]}
}
UIAbility的生命周期钩子
组件的生命周期
自定义组件的生命周期
文档中心
组件的生命周期的钩子:aboutToAppear 和aboutToDisappear
还有一些是@Entry标识的组件生命周期和activity的生命周期类似
foreach函数渲染view,得给view添加唯一标识,不然循环的时候会重新删了,再创建