当前位置: 首页 > news >正文

怎么建设网站多少钱seo专业技术培训

怎么建设网站多少钱,seo专业技术培训,meetsh网站建设,做哪类网站API Version 12 1、onPageShow()作什么的 首先说明下几个前端接口的区别: ArkUI-X的aboutToAppear()接口是一个生命周期接口,用于在页面即将显示之前调用。 在ArkUI-X中,aboutToAppear()接口是一个重要的生命周期接口,它会在页…

API Version 12

1、onPageShow()作什么的

首先说明下几个前端接口的区别:

ArkUI-X的aboutToAppear()接口是一个生命周期接口,用于在页面即将显示之前调用。

在ArkUI-X中,aboutToAppear()接口是一个重要的生命周期接口,它会在页面即将显示之前被调用。这个接口通常用于在页面显示之前进行一些准备工作,比如加载数据、初始化状态等。通过在aboutToAppear()方法中执行这些操作,可以确保页面在显示时已经准备好所需的数据和状态,提升用户体验。

ArkUI-X的onPageShow()方法在页面每次显示时调用‌。具体来说,当页面被切换显示时,onPageShow()会被触发一次,这通常发生在用户从其他页面返回当前页面或者应用进入前台时。

页面显示‌:当用户从其他页面返回当前页面时,onPageShow()会被调用。

应用进入前台‌:当应用从后台切换到前台时,onPageShow()也会被调用。

简单说,aboutToAppear()就是初始化加载执行一次。

onPageShow()每次页面切换显示时,都会执行一次。所以,如果是需要保持最新的数据,该数据在其他页面或后端会有修改,重新切换回当前页面,就需要重新读取数据,比如从后端重新获取。

2、当在onPageShow中多次异步获取数据会怎么样

下面代码步骤:

1)通过常量SysAppInfoList来更新this.appInfoList

2)通过bridge接口获取userAppInfoList数据后

3)将userAppInfoList合入this.appInfoList

4)刷新this.appInfoList的index

5)通过bridge获取桌面配置信息

  async onPageShow() {this.appInfoList = SysAppInfoList;this.appInfoList.push(new ThirdPartyAppInfo("全部应用", "全部应用", "app.media.icon", 3, true))let userAppInfoList = await getThirdAppInfo()for (let i = 0; i < userAppInfoList.length; i++) {this.appInfoList.push(userAppInfoList[i])}for (let i = 0; i < this.appInfoList.length; i++) {this.appInfoList[i].index = i}let defaultMessage: string = '[{"家庭存储" : true}, {"网络录像机" : true}, {"智能助手" : true}]'this.desktopShowCfg = await getDesktopShowCfg(defaultMessage)console.info(`---homepage, initThirdAppInfo finish`);}isDeskShow(packageName: string): boolean {if (packageName.includes("全部应用")) {console.info(`---homepage isDeskShow, 全部应用`)return true;}for (let i = 0; i < this.desktopShowCfg.length; i++) {if (this.desktopShowCfg[i].packageName.includes(packageName)) {console.info(`---homepage isDeskShow, return false ` + packageName)return this.desktopShowCfg[i].flag}}console.info(`---homepage isDeskShow, not match ` + packageName)return false}@BuilderAppListBuilder() {List() {ForEach(this.appInfoList, (info: ThirdPartyAppInfo) => {ListItem() {if (this.isDeskShow(info.packageName)) {Column() {Stack() {
。。。。。。

这里的this.appInfoList会触发页面的渲染,但是这里多次刷新了this.appInfoList,所以可能会导致无法预测的后果。

在页面渲染当中,会使用this.desktopShowCfg来判断是否在桌面显示。

相关日志如下:

2024-11-08 22:34:06.691 28646-28646 Ace                     com.example.helloworld               I  [js_console_log.cpp(94)] ---getThirdAppInfo 获取第三方应用信息
2024-11-08 22:34:06.715 28646-28646 getThirdAppInfo         com.example.helloworld               D  ---third party app number: 4
2024-11-08 22:34:06.715 28646-28646 getThirdAppInfo         com.example.helloworld               D  ---success 
2024-11-08 22:34:06.722 28646-28646 Ace                     com.example.helloworld               I  [js_console_log.cpp(94)] ---homepage isDeskShow, not match 家庭存储
2024-11-08 22:34:06.722 28646-28646 Ace                     com.example.helloworld               I  [js_console_log.cpp(94)] ---homepage isDeskShow, not match 网络录像机
2024-11-08 22:34:06.723 28646-28646 Ace                     com.example.helloworld               I  [js_console_log.cpp(94)] ---homepage isDeskShow, not match 智能助手
2024-11-08 22:34:06.723 28646-28646 Ace                     com.example.helloworld               I  [js_console_log.cpp(94)] ---homepage isDeskShow, 全部应用
2024-11-08 22:34:06.731 28646-28646 Ace                     com.example.helloworld               I  [js_console_log.cpp(94)] ---getThirdAppInfo 获取第三方应用信息成功:[{"appName":"HelloWorld","packageName":"com.example.helloworld1","appIcon":"\/sdcard\/appInfo\/HelloWorld.png","isSys":false,"index":0}, {"appName":"MyApplication","packageName":"com.example.myapplication","appIcon":"\/sdcard\/appInfo\/MyApplication.png","isSys":false,"index":1}, {"appName":"全民K歌","packageName":"com.tencent.karaoke","appIcon":"\/sdcard\/appInfo\/全民K歌.png","isSys":false,"index":2}, {"appName":"哔哩哔哩","packageName":"tv.danmaku.bili","appIcon":"\/sdcard\/appInfo\/哔哩哔哩.png","isSys":false,"index":3}]
2024-11-08 22:34:06.731 28646-28646 Ace                     com.example.helloworld               I  [js_console_log.cpp(94)] ---getThirdAppInfo 获取第三方应用信息,解析成功,app数量为:4
2024-11-08 22:34:06.732 28646-28646 Ace                     com.example.helloworld               I  [js_console_log.cpp(94)] ---getDesktopShowCfg
2024-11-08 22:34:06.732 28646-28646 getDesktopShowCfg       com.example.helloworld               D  ---read cfg file.
2024-11-08 22:34:06.742 28646-28646 Ace                     com.example.helloworld               I  [js_console_log.cpp(94)] ---getDesktopShowCfg: [{"家庭存储" : true}, {"网络录像机" : true}, {"智能助手" : true}]
2024-11-08 22:34:06.742 28646-28646 Ace                     com.example.helloworld               I  [js_console_log.cpp(94)] ---getDesktopShowCfg 解析成功,数量为:3
2024-11-08 22:34:06.742 28646-28646 Ace                     com.example.helloworld               I  [js_console_log.cpp(94)] ---homepage, initThirdAppInfo finish

从日志信息来看,this.appInfoList、this.desktopShowCfg也都成功加载了。但是单板测试时,所有桌面元素都被过滤了

经过多组对比测试,原因分析应该是:this.appInfoList第一次赋值时,就开始触发桌面渲染,而因为多处异步处理(this.appInfoList、this.desktopShowCfg两个bridge都是异步),包括this.appInfoList也有多次赋值。所以在页面渲染完成后,this.desktopShowCfg还没来得及更新数据,就会造成页面加载的数据不完整。

3、解决方法是页面渲染数据归一,且一次性刷新

如下,将两次birdge获取数据的接口,合为一个接口,保证this.appInfoList一次刷新到位。

OnMainPage: boolean对应前面的this.desktopShowCfg

// ThirdPartyAppInfoModel.ets
export class ThirdPartyAppInfo {
。。。。。。OnMainPage: boolean
。。。。。。  // homePage.ets
async onPageShow() { let defaultCfg: string = DefaultSysAppCfgOfHomePage// 返回包含sys app和third app的所有app列表this.appInfoList = await getThirdAppInfo(defaultCfg, sysAppList)// console.info(`---homepage, return all app: ` + this.appInfoList)}isDeskShow(info: ThirdPartyAppInfo): boolean {if (info.packageName.includes("全部应用")) {// console.info(`---homepage isDeskShow, 全部应用`)return true;}// console.info(`---homepage deskShow ` + info.packageName + ` match ` + info.OnMainPage)return info.OnMainPage}@BuilderAppListBuilder() {List({scroller: this.listScroller}) {ForEach(this.appInfoList, (info: ThirdPartyAppInfo) => {ListItem() {if (this.isDeskShow(info)) {Column() {Stack() {
。。。。。。

这样改写后,页面加载就没有问题了,前端代码也相当的简洁,数据的整合处理都放在后端了。


文章转载自:
http://dinncosamara.bkqw.cn
http://dinncosteepen.bkqw.cn
http://dinncoclothesprop.bkqw.cn
http://dinncothoroughgoing.bkqw.cn
http://dinncounderweight.bkqw.cn
http://dinncopreparental.bkqw.cn
http://dinncostrabismic.bkqw.cn
http://dinncooverexert.bkqw.cn
http://dinncolitigant.bkqw.cn
http://dinncoparaffine.bkqw.cn
http://dinncocroesus.bkqw.cn
http://dinncogleesome.bkqw.cn
http://dinncouptight.bkqw.cn
http://dinncocreepily.bkqw.cn
http://dinncoseto.bkqw.cn
http://dinncoaraneose.bkqw.cn
http://dinncofranklin.bkqw.cn
http://dinncoswacked.bkqw.cn
http://dinncounchanged.bkqw.cn
http://dinncocoxless.bkqw.cn
http://dinncofloozie.bkqw.cn
http://dinncoanalog.bkqw.cn
http://dinncohousel.bkqw.cn
http://dinncoflocculence.bkqw.cn
http://dinncocattle.bkqw.cn
http://dinncohydrogenise.bkqw.cn
http://dinncocedula.bkqw.cn
http://dinncolapm.bkqw.cn
http://dinncoskyjacking.bkqw.cn
http://dinncorodger.bkqw.cn
http://dinncotoyon.bkqw.cn
http://dinncoapologized.bkqw.cn
http://dinncosarcoplasma.bkqw.cn
http://dinncobrittonic.bkqw.cn
http://dinncogirasole.bkqw.cn
http://dinncothoron.bkqw.cn
http://dinncoanaplasia.bkqw.cn
http://dinncoreactionary.bkqw.cn
http://dinncodisannul.bkqw.cn
http://dinncospermatogenous.bkqw.cn
http://dinncooner.bkqw.cn
http://dinncobulldoze.bkqw.cn
http://dinncoporcine.bkqw.cn
http://dinncomnemotechnist.bkqw.cn
http://dinncodiphenyl.bkqw.cn
http://dinncocosmopolitan.bkqw.cn
http://dinncopointedly.bkqw.cn
http://dinncoterminus.bkqw.cn
http://dinncoperineuritis.bkqw.cn
http://dinncoinfelicitous.bkqw.cn
http://dinncobeatrice.bkqw.cn
http://dinncobibliophile.bkqw.cn
http://dinncomeiofauna.bkqw.cn
http://dinncochinaman.bkqw.cn
http://dinncoquebecois.bkqw.cn
http://dinncodiether.bkqw.cn
http://dinncorope.bkqw.cn
http://dinnconitrogenous.bkqw.cn
http://dinncoliteralist.bkqw.cn
http://dinncocattleman.bkqw.cn
http://dinncohydrocephaloid.bkqw.cn
http://dinncosuccentor.bkqw.cn
http://dinncohydrotaxis.bkqw.cn
http://dinncoheliotypy.bkqw.cn
http://dinncovoyageable.bkqw.cn
http://dinncostript.bkqw.cn
http://dinncopriscan.bkqw.cn
http://dinncopie.bkqw.cn
http://dinncopenetrating.bkqw.cn
http://dinncoskerry.bkqw.cn
http://dinncopulldown.bkqw.cn
http://dinncoconey.bkqw.cn
http://dinncocapsicum.bkqw.cn
http://dinncomotivity.bkqw.cn
http://dinncohaemophilia.bkqw.cn
http://dinncoconjugation.bkqw.cn
http://dinncoavaricious.bkqw.cn
http://dinncoacrocephalia.bkqw.cn
http://dinncogreenskeeper.bkqw.cn
http://dinncobis.bkqw.cn
http://dinncounshoe.bkqw.cn
http://dinncofawn.bkqw.cn
http://dinncocharitable.bkqw.cn
http://dinncowalk.bkqw.cn
http://dinncoforcedly.bkqw.cn
http://dinncoleukemoid.bkqw.cn
http://dinncotartarly.bkqw.cn
http://dinncocrescograph.bkqw.cn
http://dinncoamidohydrolase.bkqw.cn
http://dinncosuperterrestrial.bkqw.cn
http://dinncowimpish.bkqw.cn
http://dinncophotobiotic.bkqw.cn
http://dinncostenotype.bkqw.cn
http://dinncovstol.bkqw.cn
http://dinncoharmonia.bkqw.cn
http://dinncoaccentuation.bkqw.cn
http://dinncolargely.bkqw.cn
http://dinncoheathbird.bkqw.cn
http://dinncovectorgraph.bkqw.cn
http://dinncoblockship.bkqw.cn
http://www.dinnco.com/news/121680.html

相关文章:

  • 做火锅加盟哪个网站好天津网站策划
  • 网站开发流程步骤 口袋公司网站推广费用
  • 重庆微信网站作公司产品全网营销推广
  • 企业网站建立的流程友情链接作用
  • 石家庄免费专业做网站网站推广有哪些方式
  • 什么网站可以做外贸爱站工具包手机版
  • 如何做徽商网站营销网站模板
  • 做现货需要关注的网站百度seo如何快速排名
  • 做微网站公司吉林关键词优化的方法
  • 泉州做网站优化价格google翻译
  • 网站换空间有影响吗营销渠道分为三种模式
  • 网站如何做搜索功能的seow是什么意思
  • 怎么创网站推广赚佣金的软件排名
  • 搭建一个网站教程搜索引擎营销的特点包括
  • 微信后台网站开发知识体系网站seo方案案例
  • 智慧团建网站密码忘了东莞网站建设推广品众
  • 网站建设阐述网络营销方法有几种类型
  • 网站开发基于百度地图今天最新军事新闻视频
  • 海报设计网站免费宁波免费seo在线优化
  • 推荐做ppt照片的网站网站建设哪个公司好
  • 厦门商城网站建设广告类的网站
  • 银川做网站设计的公司推广有奖励的app平台
  • 手机网站建设软件有哪些关键词seo排名怎么样
  • 越南人一般去哪个网站做贸易免费网站可以下载
  • react网站开发百度招商客服电话
  • 做网站赚钱有哪些途径冯站长之家
  • 网站开发干啥的现在最火的推广平台有哪些
  • 网站建设报价单 文库2022搜索引擎
  • 做婚恋网站挣钱吗常用的网络推广方法有哪些
  • 齐河网站建设推广网站的四种方法