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

网站内部链接的作用有哪些中山做网站优化

网站内部链接的作用有哪些,中山做网站优化,供求信息网站建设报价,福建网站优化概述 本示例展示了同一设备中前后台的数据交互#xff0c;用户前台选择相应的商品与数目#xff0c;后台计算出结果#xff0c;回传给前台展示。 样例展示 基础信息 RPC连接 介绍 本示例使用[ohos.rpc]相关接口#xff0c;实现了一个前台选择商品和数目#xff0c;后台…概述 本示例展示了同一设备中前后台的数据交互用户前台选择相应的商品与数目后台计算出结果回传给前台展示。 样例展示 基础信息 RPC连接 介绍 本示例使用[ohos.rpc]相关接口实现了一个前台选择商品和数目后台计算总价的功能使用rpc进行前台和后台的通信。 效果预览 主页选择列表 使用说明 点击商品种类的空白方框弹出商品选择列表选择点击对应的商品空白方框显示相应内容。点击商品选择框后的 或 - 按钮选择商品所对应的数量。点击 Confirm an order 按钮根据相应的菜品数量与单价计算出总价并显示。 具体实现 发送数据在首页的sortString()中通过rpc.MessageSequence.create()创建MessageSequence对象然后通过MessageSequence.writeStringArray()将 我们的处理过的购物数据写入MessageSequence对象中通过rpc.RemoteObject.sendMessageRequest()将我们得出总价所需要的参数发送到进程中 源码参考[Index.ets] /** Copyright (c) 2021-2023 Huawei Device Co., Ltd.* Licensed under the Apache License, Version 2.0 (the License);* you may not use this file except in compliance with the License.* You may obtain a copy of the License at** http://www.apache.org/licenses/LICENSE-2.0** Unless required by applicable law or agreed to in writing, software* distributed under the License is distributed on an AS IS BASIS,* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.* See the License for the specific language governing permissions and* limitations under the License.*/import rpc from ohos.rpcimport ReceivedData from ../model/ReceivedDataimport { ProcessData } from ../model/ProcessDataimport { Logger } from ../common/Loggerimport { MyDataSource } from ../model/OptionsDataimport { OPTIONS } from ../muck/MyDataimport { TitleBar } from ../common/TitleBarimport { FlexList } from ../common/FlexListconst REQUEST_CODE: number 1type SelectType {subcategory: string,count: number}EntryComponentstruct Index {State send: string State result: number 0private Process: ProcessData new ProcessData()private selectStuffs: ArraySelectType new Array(4).fill({ subcategory: , count: 0 })selectStuff(index: number, good: string, count: number) {Logger.info(index ${index}, count ${count}, good ${good})this.selectStuffs[index] { subcategory: good, count: count }}async sortString(sendData: Arraystring) {Logger.info(sortString is ${sendData})Logger.info(sendData typeof ${typeof (sendData)})let option: rpc.MessageOption new rpc.MessageOption()let data: rpc.MessageSequence rpc.MessageSequence.create()let reply: rpc.MessageSequence rpc.MessageSequence.create()Logger.info(getCallingUid: ${ReceivedData.getCallingUid()} getCallingPid: ${ReceivedData.getCallingPid()})data.writeStringArray(sendData)try {await ReceivedData.sendMessageRequest(REQUEST_CODE, data, reply, option)} catch (err) {Logger.error(sortString failed, ${JSON.stringify(err)})}this.result reply.readInt()reply.reclaim()}build() {Scroll() {Column() {TitleBar()LazyForEach(new MyDataSource(OPTIONS), (item, index) {Row() {FlexList({category: item.category,menu: item.subcategory,index: index,selectStuff: this.selectStuff.bind(this)})}}, item JSON.stringify(item))Column() {Row() {Text($r(app.string.final_price)).width(65%).height(25).fontSize(18).textAlign(TextAlign.Center)Text(this.result.toString()).id(totalPrice).height(25).fontSize(20).margin({ left: 5% }).textAlign(TextAlign.Center)}.justifyContent(FlexAlign.Center).width(80%)Button($r(app.string.confirm)).id(confirmOrderBtn).width(80%).height(40).margin({ top: 30 }).onClick(() {let priceArray this.Process.getPrice(this.selectStuffs)Logger.info(priceArray ${priceArray})this.sortString(priceArray)})}.width(100%).justifyContent(FlexAlign.Center).margin({ top: 20 }).height(30%)}.width(100%)}}}读取数据处理MessageRequest请求的接口封装在ReceivedData里面在这里接收传递来的数据然后经过处理得出总价 并通过rpc.MessageParcel.writeInt()写入MessageParcel对象源码参考[ReceivedData.ets] /** Copyright (c) 2021-2023 Huawei Device Co., Ltd.* Licensed under the Apache License, Version 2.0 (the License);* you may not use this file except in compliance with the License.* You may obtain a copy of the License at** http://www.apache.org/licenses/LICENSE-2.0** Unless required by applicable law or agreed to in writing, software* distributed under the License is distributed on an AS IS BASIS,* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.* See the License for the specific language governing permissions and* limitations under the License.*/import rpc from ohos.rpcimport { Logger } from ../common/Loggerimport { PRICE_LIST } from ../muck/MyDataconst TAG [eTSRPC.ReceivedData]let resultList: Arraynumber Array.from({ length: 4 }, () 0)class ReceivedData extends rpc.RemoteObject {onRemoteRequest(code: number, data: rpc.MessageParcel, reply: rpc.MessageParcel, option: rpc.MessageOption): boolean {Logger.info(TAG, called)if (code 1) {let result 0let readIntArrtry {readIntArr data.readStringArray()} catch (err) {Logger.error(readStringArray failed, code is ${err.code}, message is ${err.message})}Logger.info(TAG, readIntArr ${readIntArr})for (let i 0; i 4; i) {if (readIntArr[i] 0) {resultList[i] 0} else {resultList[i] PRICE_LIST.get(readIntArr[i]) * Number(readIntArr[i4])}Logger.info(TAG, this.resultList ${resultList})result resultList[i]}try {reply.writeInt(result)} catch (err) {Logger.error(TAG, writeInt failed, code is ${err.code}, message is ${err.message})}Logger.info(TAG, result ${result})} else {Logger.info(TAG, unknown request code)}return true}}export default new ReceivedData(send)鸿蒙OpenHarmony知识待更新
http://www.w-s-a.com/news/808179/

相关文章:

  • 成都企业网站公司wordpress内页模板
  • 58同城建网站怎么做wordpress评论显示数字ip
  • 免费制作论坛网站模板免费下载北京网站制作长沙
  • 旅游网网站建设网站如何自己做seo
  • 如何验证网站所有权做二手家具回收哪个网站好
  • 做哪种网站赚钱项目开发流程
  • 网站建设和网站网络推广网站建设软件定制
  • 站长工具网址查询全球云邮登陆网站
  • 宁波 住房和建设局网站网上发帖推广
  • 平面设计在线网站工业设计公司有哪些
  • 福州网站设计外包公司网站做的比较好
  • 如何设计网站首页网站开发综合技能实训心得体会
  • 用织梦做的网站好用吗w网站链接如何做脚注
  • 东莞做网站公司在哪哪里有网站培训的
  • 做宣传 为什么要做网站那重庆网站建设公司在线联系
  • 网站设计制作售价多少钱制作图片的软件是
  • 网站验证码目录简单带数据库的网站模版
  • 制作网站用c#做前台网站建设专题的意义
  • 广西建设职业技术学院教育网站牡丹区建设局网站
  • 网站后台怎么用ftp打开上海外贸进出口有限公司
  • 淘宝建设网站的意义大学生做那个视频网站
  • 如何提高你的网站的粘性建设银行流水网站
  • 微信h5在哪个网站做泰州专业网站制作公司
  • 现在.net做网站的多吗建设工程造价网
  • pc访问手机网站跳转违法网站开发人员
  • 网站前端做报名框wordpress 启动慢
  • 沈阳做网站客户多吗前端可以做网站吗
  • 网站设计规划书新媒体营销策略分析
  • dw个人网站主页怎么做天津工程信息建设网
  • 顺义做网站的公司网站页面设计基础教程