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

泉州建站方案如何快速推广网上国网

泉州建站方案,如何快速推广网上国网,手机怎么创建网页快捷方式,asp 网站模板整体框架搭建 主页面、本地库组件页面、社区库组件页面三个页面组成,主页面由Navigation作为根组件实现全局标题,由Tabs组件实现本地库和社区库页面的切换。 // MainPage.ets import { Outer } from ../view/OuterComponent; import { Inner } from ..…

整体框架搭建

主页面、本地库组件页面、社区库组件页面三个页面组成,主页面由Navigation作为根组件实现全局标题,由Tabs组件实现本地库和社区库页面的切换。

// MainPage.ets
import { Outer } from '../view/OuterComponent';
import { Inner } from '../view/InnerComponent';
import { CommonConstants } from '../common/constants/CommonConst';@Entry
@Component
struct Index {private controller: TabsController = new TabsController();@State currentIndex: number = 0;...build() {Column() {Navigation() {Tabs({ barPosition: BarPosition.Start, controller: this.controller }) {TabContent() {Inner()}.tabBar(this.TabBuilder(CommonConstants.FIRST_TAB))TabContent() {Outer()}.tabBar(this.TabBuilder(CommonConstants.SECOND_TAB))}.barWidth(CommonConstants.BAR_WIDTH).barHeight($r('app.float.default_56')).onChange((index: number) => {this.currentIndex = index;})}.titleMode(NavigationTitleMode.Mini).title(this.NavigationTitle).hideBackButton(true)}.backgroundColor($r('app.color.app_bg'))}
}

在pages文件夹下新建components文件并在此文件夹下创建两个ArkTS文件,分别命名为inner和outer,至此整体框架搭建完毕。

本地库实现

本地库主要是指未上架到ohpm中心且在项目组内共享使用的库文件,这类库需要开发者在项目中创建并开发新的Library模块,创建步骤如下:

  1. 通过如下两种方法,在HarmonyOS工程中添加HarmonyOS ohpm块。
  • 方法1:鼠标移到工程目录顶部,单击鼠标右键,选择New>Module。
  • 方法2:在菜单栏选择File > New > Module。
  1. 在Choose Your Ability Template界面中,选择Static Library,并单击Next。
  2. 在Configure the New Module界面中,设置新添加的模块信息,设置完成后,单击Finish完成创建。
  • Module name:新增模块的名称。
  • Language:选择开发HarmonyOS ohpm包的语言。
  • Device type:选择HarmonyOS ohpm包支持的设备类型。
  • Enable Native:是否创建一个用于调用C++代码的HarmonyOS ohpm共享模块。
  1. 创建完成后,会在工程目录中生成HarmonyOS ohpm共享模块及相关文件。

本Codelab在本地库中实现了对Button组件的简单封装。

// Buttons.ets
import ButtonViewModel from '../../viewmodel/ButtonsViewModel';@Component
export struct Buttons {@Prop buttonText: string = '';@Prop stateEffect: boolean = false;@Prop buttonShape: string = '';@Prop buttonType: string = '';@Prop fontColor: string = '';...build() {Row() {Column() {Button({ type: ButtonViewModel.fetchType(this.buttonShape),stateEffect: this.stateEffect }) {Text(this.buttonText).fontSize($r('app.float.default_16')).fontColor(this.fontColor || $r('app.color.white'))}.width($r('app.float.default_90')).height($r('app.float.default_35')).backgroundColor(ButtonViewModel.fetchBackgroundColor(this.buttonType))}}}
}

如果想在Codelab的主工程代码中引用本地库,有如下两种方式: 方式一:在Terminal窗口中,执行如下命令进行安装,并会在oh-package.json5中自动添加依赖。 ohpm install …/library --save 方式二:在工程的oh-package.json5中设置HarmonyOS ohpm三方包依赖,配置示例如下: “dependencies”: { “@ohos/library”: “file:…/library” } 依赖设置完成后,需要执行ohpm install命令安装依赖包,依赖包会存储在工程的oh_modules目录下。 ohpm install

在完成上述步骤后,我们继续完成inner页面的开发,在inner页面中我们通过import的方式引入开发的本地库,并通过循环传入不同的参数展示不同的button。

// InnerComponent.ets
import { Buttons } from '@ohos/library';@Component
export struct Inner {@State buttonList: ButtonList[] = InnerViewModel.getButtonListData();scroller: Scroller = new Scroller();build() {Scroll(this.scroller) {Column({ space: CommonConstants.SPACE_12 }) {ForEach(this.buttonList, (item: ButtonList) => {Column() {Flex({direction: FlexDirection.Column,justifyContent: FlexAlign.SpaceBetween,alignItems: ItemAlign.Start}) {Column() {...}.alignItems(HorizontalAlign.Start)Column() {Buttons({buttonText: item.buttonText,buttonShape: item.buttonShape,buttonType: item.buttonType,stateEffect: item.stateEffect,fontColor: item.fontColor}).alignSelf(ItemAlign.Center).margin({ bottom: $r('app.float.default_21') })}.width($r('app.float.default_260')).height($r('app.float.default_90')).backgroundImage($r('app.media.mobile')).backgroundImageSize(ImageSize.Contain).justifyContent(FlexAlign.End).alignSelf(ItemAlign.Center).align(Alignment.End)}.padding({bottom: $r('app.float.default_24')}).width(CommonConstants.CONTAINER_WIDTH).height(CommonConstants.CONTAINER_HEIGHT)}.width(CommonConstants.CONTAINER_WIDTH).aspectRatio(CommonConstants.ASPECT_RATIO_176).padding({top: $r('app.float.default_12'),left: $r('app.float.default_8')}).backgroundColor($r('app.color.white')).borderRadius($r('app.float.default_24'))})}.width(CommonConstants.CONTAINER_WIDTH).padding({left: $r('app.float.default_12'),right: $r('app.float.default_12'),top: $r('app.float.default_12')})}.scrollable(ScrollDirection.Vertical).scrollBar(BarState.Off).margin({ bottom: $r('app.float.default_24') })}
}

社区库调用

社区库是指已经由贡献者上架到ohpm中心供其他开发者下载使用的库,调用这类库的方法如下: 通过如下两种方式设置HarmonyOS ohpm三方包依赖信息(下面步骤以@ohos/lottie三方库为例,其他库替换对应库的名字及版本号即可):

  • 方式一:在Terminal窗口中,执行如下命令安装HarmonyOS ohpm三方包,DevEco Studio会自动在工程的oh-package.json5中自动添加三方包依赖。ohpm install @ohos/lottie --save
  • 方式二:在工程的oh-package.json5中设置HarmonyOS ohpm三方包依赖,配置示例如下: “dependencies”: { “@ohos/lottie”: “^2.0.0” } 依赖设置完成后,需要执行ohpm install命令安装依赖包,依赖包会存储在工程的oh_modules目录下。 ohpm install

在完成上述步骤后,我们继续完成outer页面的开发,在outer页面中我们通过import的方式引入配置的社区库,并实现对社区库动画的调用。

// OuterComponent.ets
import lottie, { AnimationItem } from '@ohos/lottie';
import Logger from '../common/utils/log/logger';
import { CommonConstants } from '../common/constants/CommonConst';@Component
export struct Outer {private renderingSettings: RenderingContextSettings = new RenderingContextSettings(true);private renderingContext: CanvasRenderingContext2D = new CanvasRenderingContext2D(this.renderingSettings);private animateName: string = CommonConstants.ANIMATE_NAME;private animateItem: AnimationItem | null = null;@State canvasTitle: Resource | undefined = undefined;...build() {Flex({ direction: FlexDirection.Column, justifyContent: FlexAlign.SpaceBetween }) {// Canvas areaColumn() {Canvas(this.renderingContext).width(CommonConstants.CONTAINER_WIDTH).aspectRatio(CommonConstants.ASPECT_RATIO_176).backgroundImage($r('app.media.canvasBg')).backgroundImageSize(ImageSize.Cover).onDisAppear(() => {lottie.destroy(this.animateName);})...}.margin({top: $r('app.float.default_10'),left: $r('app.float.default_10'),right: $r('app.float.default_10')})// Buttons areaColumn({ space: CommonConstants.SPACE_12 }) {Button() {...}.width(CommonConstants.CONTAINER_WIDTH).height($r('app.float.default_40')).backgroundColor($r('app.color.outer_button_bg')).onClick(() => {if (this.animateItem !== null) {this.animateItem.destroy();this.animateItem = null;}this.canvasTitle = $r('app.string.outer_button_load');this.animateItem = lottie.loadAnimation({container: this.renderingContext,renderer: 'canvas',loop: 10,autoplay: true,name: this.animateName,path: 'common/lottie/data.json'});})...}}.padding({left: $r('app.float.default_23'),right: $r('app.float.default_23'),bottom: $r('app.float.default_41')})}.height(CommonConstants.CONTAINER_HEIGHT)}
}

本文主要是对鸿蒙开发中ArkTS,库的运用。有关鸿蒙的开发知识还有很多,系统性的学习可以前往《鸿蒙开发4.0基础-高阶文档》,学习鸿蒙路线图分享:

最后

向开发者展示了在Stage模型中,如何调用已经上架的社区库和项目内创建的本地库。效果如图所示:


文章转载自:
http://dinncotipcart.knnc.cn
http://dinncocarnet.knnc.cn
http://dinncounfeatured.knnc.cn
http://dinncocorbeil.knnc.cn
http://dinncodig.knnc.cn
http://dinncoyeomen.knnc.cn
http://dinncolevitical.knnc.cn
http://dinncojudgment.knnc.cn
http://dinncoobsecration.knnc.cn
http://dinncohandicraftsman.knnc.cn
http://dinncoomnifarious.knnc.cn
http://dinncoanthracoid.knnc.cn
http://dinncoapposition.knnc.cn
http://dinncorezaiyeh.knnc.cn
http://dinncoargentina.knnc.cn
http://dinncoaigrette.knnc.cn
http://dinncomonodactylous.knnc.cn
http://dinncocoreper.knnc.cn
http://dinncomaqui.knnc.cn
http://dinncopostmaster.knnc.cn
http://dinncomound.knnc.cn
http://dinncorepublicanize.knnc.cn
http://dinncosophisticate.knnc.cn
http://dinncoindividualize.knnc.cn
http://dinncocdrom.knnc.cn
http://dinncoochre.knnc.cn
http://dinncochainlet.knnc.cn
http://dinncotelautogram.knnc.cn
http://dinncofrancine.knnc.cn
http://dinncoautonomic.knnc.cn
http://dinncomisguidance.knnc.cn
http://dinncosignorine.knnc.cn
http://dinncodisulfoton.knnc.cn
http://dinncomuonium.knnc.cn
http://dinncoeletricity.knnc.cn
http://dinnconeuss.knnc.cn
http://dinncoequivocal.knnc.cn
http://dinncoodorously.knnc.cn
http://dinncosupervenient.knnc.cn
http://dinncohydrasorter.knnc.cn
http://dinncoratproofed.knnc.cn
http://dinncogingham.knnc.cn
http://dinncofairlead.knnc.cn
http://dinncotelemetry.knnc.cn
http://dinncoanticholinergic.knnc.cn
http://dinncoladle.knnc.cn
http://dinncokeystoner.knnc.cn
http://dinncopecs.knnc.cn
http://dinncodevilish.knnc.cn
http://dinncobloodiness.knnc.cn
http://dinncoprimigenial.knnc.cn
http://dinncomessmate.knnc.cn
http://dinncoappurtenant.knnc.cn
http://dinncobeaux.knnc.cn
http://dinncodissociate.knnc.cn
http://dinncoichthyic.knnc.cn
http://dinncoirritation.knnc.cn
http://dinncoandrophore.knnc.cn
http://dinncofantast.knnc.cn
http://dinncozs.knnc.cn
http://dinncobelch.knnc.cn
http://dinncomedievalize.knnc.cn
http://dinncocecrops.knnc.cn
http://dinncomotard.knnc.cn
http://dinncomagnesium.knnc.cn
http://dinncoflea.knnc.cn
http://dinnconacu.knnc.cn
http://dinncobaldwin.knnc.cn
http://dinncoglossology.knnc.cn
http://dinncogaya.knnc.cn
http://dinncomicrowatt.knnc.cn
http://dinncoinexplicit.knnc.cn
http://dinncojeannette.knnc.cn
http://dinncoconglobulation.knnc.cn
http://dinncothence.knnc.cn
http://dinncomosfet.knnc.cn
http://dinncoiconolatry.knnc.cn
http://dinncosalwar.knnc.cn
http://dinncoextrarenal.knnc.cn
http://dinncogeomagnetic.knnc.cn
http://dinncowhittle.knnc.cn
http://dinncoimperturbability.knnc.cn
http://dinncowecker.knnc.cn
http://dinncoballetomane.knnc.cn
http://dinncodbms.knnc.cn
http://dinncoeastward.knnc.cn
http://dinncoankyloglossia.knnc.cn
http://dinncoascertainment.knnc.cn
http://dinncoidiomatic.knnc.cn
http://dinncotransformerless.knnc.cn
http://dinncoroo.knnc.cn
http://dinncokeratotomy.knnc.cn
http://dinncochartometer.knnc.cn
http://dinncoablation.knnc.cn
http://dinncoseletron.knnc.cn
http://dinncomicrospore.knnc.cn
http://dinncolaparotome.knnc.cn
http://dinncosciamachy.knnc.cn
http://dinncojouk.knnc.cn
http://dinncorockbound.knnc.cn
http://www.dinnco.com/news/124402.html

相关文章:

  • 湖南广厦建设工程有限公司网站全球搜索引擎排名
  • 网站建设文翻译工作室利尔化学股票股吧
  • 网站 设计公司 温州刚刚中国出啥大事了
  • 网站的虚拟人怎么做的做电商一个月能挣多少钱
  • 做高大上分析的网站建立网站怎么搞
  • 铜陵app网站做营销招聘海口seo快速排名优化
  • 大型门户网站都有荆门网络推广
  • 电商网站建设那家好网络营销推广外包平台
  • 网站建站费用多少百度快速排名用是
  • 在家做网站或ps挣钱接活百度推广账号出售
  • 越南做网站服务器seo排名赚钱
  • 网站开发的前台开发工具温州seo顾问
  • 转运网站建设网站建设免费
  • 网站建设明细报价表 服务器上海搜索推广
  • php动态网站开发案例宁波网站推广运营公司
  • flash手机网站制作海口关键词优化报价
  • 怎样做网站外链莱阳seo排名
  • 做网站怎样投放广告长尾关键词排名系统
  • 网站开发代理商郑州seo团队
  • 做公司展示网站如何提高自己的营销能力
  • 中国建设招标网站中标公告seo专业培训学费多少钱
  • 学做衣服网站知乎域名检测
  • 客服网站怎么做网络营销促销策略有哪些
  • 手机版网站快照如何做互联网营销策略有哪些
  • 百度seo招聘东莞seo推广机构帖子
  • 如何诊断网站怎样制作一个自己的网站
  • 合肥做公司网站联系方式注册公司网站
  • 答题助手网站怎么做的成全高清免费观看mv
  • 哪个b2b网站做固定排名好怎样在网上做宣传
  • 做网站赌博应该注意什么二手交易平台