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

建设营销型网站有哪些步骤工程建设标准网站

建设营销型网站有哪些步骤,工程建设标准网站,网站是用虚拟机做还是服务器,域名对网站的好处前言 根据第三方机构Counterpoint数据,截至2023年三季度末,HarmonyOS在中国智能手机操作系统的市场份额已经提升至13%。短短四年的时间,HarmonyOS就成长为仅次于安卓、苹果iOS的全球第三大操作系统。 因此,对于鸿蒙生态建设而言&a…

前言

根据第三方机构Counterpoint数据,截至2023年三季度末,HarmonyOS在中国智能手机操作系统的市场份额已经提升至13%。短短四年的时间,HarmonyOS就成长为仅次于安卓、苹果iOS的全球第三大操作系统。
因此,对于鸿蒙生态建设而言,2024年可谓至关重要,而生态建设的前提,就是要有足够的开发人才。与之对应的,今年春招市场上与鸿蒙相关岗位和人才旺盛的热度,一方面反应了鸿蒙生态的逐渐壮大,另一方面也让人们对鸿蒙下一阶段的发展更具信心。

对于想要换个赛道的程序员们现在可以抓紧时间学起来了哦。

今天来跟大家聊一下鸿蒙同模块不同模块下的UIAbility跳转

●UIAbility组件作为系统调度的核心单元,为应用提供了用于绘制界面的窗口。
●在单个UIAbility组件内,可以利用多个页面完成一个功能模块的构建。
●每个UIAbility组件实例都与任务列表中的一个任务相对应。
●在项目开发中,为了分解多个任务,我们可以通过创建多个Ability来实现任务的细分。
在这里插入图片描述

同模块下UIAbility跳转

在同一个模块下,创建Ability,如下图所示:
在这里插入图片描述
在这里插入图片描述

我们展示一下从EntryAbility的A页面跳转到TwoAbility的B页面的过程。
注意:一定要使用模拟器进行跳转
在这里插入图片描述

EntryAbility的A页面代码

import common from '@ohos.app.ability.common'
import Want from '@ohos.app.ability.Want'
@Entry
@Component
struct APage {@State message: string = 'EntryAbility----------A页面'build() {Row() {Column() {Text(this.message).fontSize(50).fontWeight(FontWeight.Bold)Button('跳转到TwoAbility的B页面').onClick(()=>{const context = getContext(this) as common.UIAbilityContextconst want:Want = {"deviceId":'',//空代表相同设备跳转"bundleName":"com.example.myapplicationproject",//包名---->app.json5中查找"abilityName":"TwoAbility",//Ability名,从module.json5中查找"moduleName":"entry",//模块名,非必写}context.startAbility(want)})}.width('100%')}.height('100%')}
}

在这里插入图片描述

TwoAbility的B页面代码

import router from '@ohos.router'
@Entry
@Component
struct BPage {@State message: string = 'twoAbility----------B页面'build() {Row() {Column() {Text(this.message).fontSize(50).fontWeight(FontWeight.Bold)Button('返回到EntryAbility的A页面').onClick(()=>{// 因为是同个模块,可以直接back返回router.back()})}.width('100%')}.height('100%')}
}

在这里插入图片描述

因为是同个模块的跳转,所以直接用router.back即可返回。

不同模块下UIAbility跳转

新建一个模块
在这里插入图片描述
在这里插入图片描述
在这里插入图片描述
在这里插入图片描述

创建完成,我的项目下就有两个模块,一个是entry,一个是TwoAbility
在这里插入图片描述

● 现在有一个功能,需要由entry模块的differentModuleA页面携带当前时间跳转到TwoAbility模块的differentModuleB页面,并在B页面接收A页面传过来的时间。

注意:不同的模块之间进行跳转的时候,需要在模拟器中进行一项配置,掉起两个模块

在这里插入图片描述
在这里插入图片描述

differentModuleA跳转代码详解

const context = getContext(this) as common.UIAbilityContext
const want:Want={"deviceId":'',//空代表相同设备跳转"bundleName":"com.example.myapplicationproject",//包名---->app.json5中查找"abilityName":"TwoApplicationAbility",//Ability名,从module.json5中查找。跳转页面的ability名,建议都从moudule.json5中复制,防止出错。"moduleName":"TwoApplication",//模块名,跳转页面的模块名"parameters":{//传递的参数id:Date.now()}}context.startAbility(want)

differentModuleB页面接收代码需要在Ability文件中接收,即本文的TwoApplicationAbility.ets中。在此文件中有一个onCreate()中,有一个want,用来接收参数。

// 定义类型
type AbilityParams=Record<string,number>
onCreate(want, launchParam) {// 接收从entry模块的DifferentA页面传递过来的参数const params = want.parameters as AbilityParams// 存储AppStorage.SetOrCreate<number>("id",params.id)hilog.info(0x0000, 'testTag', '%{public}s', 'Ability onCreate');
}

differentModuleA页面完整代码

import common from '@ohos.app.ability.common'
import Want from '@ohos.app.ability.Want'
@Entry
@Component
struct DifferentModuleA {@State message: string = 'Entry模块---DifferentModuleA页面'build() {Row() {Column() {Text(this.message).fontSize(50).fontWeight(FontWeight.Bold)Button('跳转到TwoAbility的DifferentModuleB页面').onClick(()=>{const context = getContext(this) as common.UIAbilityContextconst want:Want={"deviceId":'',//空代表相同设备跳转"bundleName":"com.example.myapplicationproject",//包名---->app.json5中查找"abilityName":"TwoApplicationAbility",//Ability名,从module.json5中查找。跳转页面的ability名,建议都从moudule.json5中复制,防止出错。"moduleName":"TwoApplication",//模块名,跳转页面的模块名"parameters":{id:Date.now()}}context.startAbility(want)})}.width('100%')}.height('100%')}
}

differentModuleB页面完整代码

@Entry
@Component
struct DifferentModuleB {@State message: string = 'TwoAbility模块的---DifferentModuleB页面'@StorageLink("id")numId:number=0build() {Row() {Column() {Text(this.message).fontSize(50).fontWeight(FontWeight.Bold)Text(`接收到的参数${this.numId}`)}.width('100%')}.height('100%')}
}

[一定要在ability.ets中更改入口文件,不然可能跳转不到你想去的页面]

在这里插入图片描述
在这里插入图片描述

● differentModuleB返回到differentModuleA的时候传递给differentModuleA参数

differentModuleB跳转代码

('返回到DirrerentA页面').onClick(()=>{const context = getContext(this) as common.UIAbilityContextcontext.terminateSelfWithResult({resultCode:1,want:{"deviceId":'',"bundleName":'com.example.myapplicationproject',//包名"abilityName":"EntryAbility",//A模块的ability名"moduleName":"entry",//A模块的模块名"parameters":{// 返回的参数"result":"ok"}}})
})

注意:differentModuleA页面接收参数的时候不用在ability.ets中接收在AppStorage的形式存储到全局。differentModuleA页面跳转的时候有一个方法直接可以用来接收返回的参数。代码如下:

Button('跳转到TwoAbility的DifferentModuleB页面').onClick(async ()=>{const context = getContext(this) as common.UIAbilityContextconst want:Want={"deviceId":'',"bundleName":"com.example.myapplicationproject","abilityName":"TwoApplicationAbility","moduleName":"TwoApplication","parameters":{id:Date.now()}}//发起一个模块,不会接收结果参数// context.startAbility(want)//发起一个模块,接收结果参数const result = await context.startAbilityForResult(want);// 是异步的const params = result.want?.parameters as resultClassif(params?.result){AlertDialog.show({message:'成功'})}else{AlertDialog.show({message:'失败'})}
})

在这里插入图片描述

写在最后

总的来说,华为鸿蒙不再兼容安卓,对中年程序员来说是一个挑战,也是一个机会。随着鸿蒙的不断发展以及国家的大力支持,未来鸿蒙职位肯定会迎来一个大的爆发,只有积极应对变化,不断学习和提升自己,我们才能在这个变革的时代中立于不败之地。在这里插入图片描述

http://www.yayakq.cn/news/931310/

相关文章:

  • 网站怎么放到服务器上襄阳seo推广
  • 怎样说服老板做网站友情链接是免费的吗
  • 台州做网站多少钱建设网站企业专业服务
  • 起域名网站wordpress登陆新域名
  • 做网站的软件叫什么软件免费的网页网站
  • 北京网站建设熊掌号网页设计案例分析ppt
  • 展示型网站有哪些内容alexa排名全球前50网站
  • 中国十大知名网站建设软件开发培训出来好找工作吗
  • 网站营销培训房屋竣工验收备案表网上查询
  • 做签名的网站Wordpress 充值 卡密
  • 网站排行查询虚拟主机wordpress安装教程
  • 上海龙华医院的网站建设西宁网站推广
  • 亚马逊网上购物商城广告优化师面试
  • 修改网站的设计交换链接的其它叫法是
  • 网站建设需要用到iis吗软件开发人员犯罪
  • 网站 多语言成都网页设计制作
  • 国外网站无法访问做网赌需要在哪些网站投广告
  • ftp建网站做网站建设怎么样
  • 做网站关键词优化的公司建站之星网站建设系统
  • 莆田网站制作报价wordpress 编辑页脚
  • 用php做的网站怎么上传软件开发流程详细
  • 电影网站建设策划书安居客二手房出售信息
  • 国内网站搭建58和搜房那个网站做房产好
  • 网站教程dw湘潭seo优化价格
  • 太原建站公司点击查看网站如何做微信支付宝
  • 网站开发公司目前主营业务百度公司推广
  • 自己做的简单网站下载小规模纳税人企业所得税怎么征收
  • 网站的建设和推广我想建网站
  • 做网站市场报价宿迁58同城二手房出售
  • 外贸 礼品 网站赤峰网站建设培训学校