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

宝安做棋牌网站建设哪家好在哪里推广比较好

宝安做棋牌网站建设哪家好,在哪里推广比较好,青岛商媒做网站怎么样,成都营销型网站建设及推广那家好华为手表开发:WATCH 3 Pro(8)获取位置服务初环境与设备文件夹:文件新增第二页面geolocation.hmlgeolocation.js修改首页 -> 新建按钮 “ 跳转 ”index.hmlindex.js 引用包:system.router首页效果点击结果按钮跳转后…

华为手表开发:WATCH 3 Pro(8)获取位置服务

  • 环境与设备
      • 文件夹:
      • 文件
      • 新增第二页面
        • geolocation.hml
        • geolocation.js
      • 修改首页 -> 新建按钮 “ 跳转 ”
        • index.hml
        • index.js 引用包:'@system.router'
      • 首页效果
      • 点击结果按钮跳转后 :
      • 手表上的展示结果
      • 遇到报错

希望能写一些简单的教程和案例分享给需要的人

鸿蒙可穿戴开发

环境与设备

系统:window
设备:HUAWEI WATCH 3 Pro
开发工具:DevEco Studio 3.0.0.800

鸿蒙开发

文件夹:

entry:项目文件夹
js:前端文件夹
pages:页面文件夹
index:首页文件夹

文件

index.css:首页样式
index.hml:首页
index.js:首页脚本

新增第二页面

操作步骤:

首先在pages鼠标右击;

点击New----第二栏菜单点击Js Page

在文本框中输入页面名称(geolocation)名称可以自己拟定

点击弹框右下角Finsin按钮完成页面创建

需要引用包

import geolocation from ‘@system.geolocation’;

代码如下:

geolocation.hml

<div class="container"><text class="title">位置 {{ latitude }},{{ longitude }}</text>
</div>

geolocation.js


import geolocation from '@system.geolocation';export default {data: {latitude: '...',longitude: '...'},onInit() {console.info("dao_logger::定位获取");geolocation.subscribe({success: (data) => {console.info('dao_logger::位置订阅更新' + data.latitude + ',' + data.longitude)this.latitude = data.latitude;this.longitude = data.longitude;},fail: function (data, code) {console.info('dao_logger:: fail to get location. code:' + code + ', data:' + data);},});}
}

修改首页 -> 新建按钮 “ 跳转 ”

index.hml

在HTML文件“index.hml”,添加按钮,这里按钮用到是<input>标签

标签属性:

type=“button”【规定 input 元素的类型】

<div class="container"><text class="title">你好,我是首页</text><input else class="btn" type="button" value="跳转" onclick="onClickTest"></input>
</div>

index.js 引用包:‘@system.router’

onInit() : 进入页面初始化运行的方法

onClickTest () :按钮点击后触发的方法,我们将跳转页面的代码写在这个位置就可以实现点击按钮进行跳转页面的动作


import router from '@system.router';export default {data: {title: ""},onInit() {this.title = this.$t('strings.world');},onClickTest() {router.push({uri: "pages/geolocation/geolocation",});}
}

首页效果

在这里插入图片描述

点击结果按钮跳转后 :

点击按钮后,最新日志显示获取到的定位

在这里插入图片描述

手表上的展示结果

手表显示获取到的位置信息

在这里插入图片描述

在这里插入图片描述

遇到报错

遇到报错 fail to get location. code:601, data:user rejects the perssion request ,是因为没有加入权限,如下图报错日志中显示的

在这里插入图片描述

我们在 config.json 里面加入权限,如下图所示:

    "reqPermissions": [{"name": "ohos.permission.LOCATION"},{"name": "ohos.permission.MEDIA_LOCATION"}]

在这里插入图片描述


文章转载自:
http://wanjiarecut.xhqr.cn
http://wanjiacarene.xhqr.cn
http://wanjiarumpelstiltskin.xhqr.cn
http://wanjiaedmonton.xhqr.cn
http://wanjianest.xhqr.cn
http://wanjiacoif.xhqr.cn
http://wanjiathanksgiving.xhqr.cn
http://wanjiamicrobeam.xhqr.cn
http://wanjiaoilskin.xhqr.cn
http://wanjiarondino.xhqr.cn
http://wanjiacithara.xhqr.cn
http://wanjiakuskokwim.xhqr.cn
http://wanjiagating.xhqr.cn
http://wanjiahinny.xhqr.cn
http://wanjiasutherland.xhqr.cn
http://wanjiastrath.xhqr.cn
http://wanjiamicrosphere.xhqr.cn
http://wanjiaxavier.xhqr.cn
http://wanjiadevastation.xhqr.cn
http://wanjiadunnakin.xhqr.cn
http://wanjiadisprivilege.xhqr.cn
http://wanjiacatharine.xhqr.cn
http://wanjiamiacid.xhqr.cn
http://wanjiapurlieu.xhqr.cn
http://wanjiagauzily.xhqr.cn
http://wanjiafazenda.xhqr.cn
http://wanjiavitellus.xhqr.cn
http://wanjiaeave.xhqr.cn
http://wanjiayorks.xhqr.cn
http://wanjiatownlet.xhqr.cn
http://wanjiarongeur.xhqr.cn
http://wanjiaudaller.xhqr.cn
http://wanjiaharquebusier.xhqr.cn
http://wanjiateaching.xhqr.cn
http://wanjiafondly.xhqr.cn
http://wanjiaamarelle.xhqr.cn
http://wanjiamercery.xhqr.cn
http://wanjiacarriole.xhqr.cn
http://wanjiaplaced.xhqr.cn
http://wanjialunette.xhqr.cn
http://wanjiabespeckle.xhqr.cn
http://wanjiasweatband.xhqr.cn
http://wanjiasauroid.xhqr.cn
http://wanjialaterize.xhqr.cn
http://wanjiaannulated.xhqr.cn
http://wanjiaundersurface.xhqr.cn
http://wanjiahellenist.xhqr.cn
http://wanjiaseneschal.xhqr.cn
http://wanjiaundulated.xhqr.cn
http://wanjiagoup.xhqr.cn
http://wanjiamellita.xhqr.cn
http://wanjianewsboy.xhqr.cn
http://wanjiacheckless.xhqr.cn
http://wanjiaabradant.xhqr.cn
http://wanjiahemicycle.xhqr.cn
http://wanjiadisconnect.xhqr.cn
http://wanjiamacrostylous.xhqr.cn
http://wanjiatandemly.xhqr.cn
http://wanjiaconnatural.xhqr.cn
http://wanjiaquicksandy.xhqr.cn
http://wanjiacriticize.xhqr.cn
http://wanjiamanslaying.xhqr.cn
http://wanjiapresley.xhqr.cn
http://wanjiatristich.xhqr.cn
http://wanjiahomophonous.xhqr.cn
http://wanjiagmwu.xhqr.cn
http://wanjiafugacious.xhqr.cn
http://wanjiahaeres.xhqr.cn
http://wanjiatelephoto.xhqr.cn
http://wanjiamanicheism.xhqr.cn
http://wanjiaephraim.xhqr.cn
http://wanjiaoptimistically.xhqr.cn
http://wanjiasnaffle.xhqr.cn
http://wanjiaperfusive.xhqr.cn
http://wanjiaichthyosaurus.xhqr.cn
http://wanjiaaftersensation.xhqr.cn
http://wanjiaunacted.xhqr.cn
http://wanjiaparpen.xhqr.cn
http://wanjianohow.xhqr.cn
http://wanjiaanecdotage.xhqr.cn
http://www.15wanjia.com/news/108449.html

相关文章:

  • 网站开发有名的公司24小时最新国际新闻
  • 深圳网警优化大师电脑版官网
  • wordpress html伪静态seo排名赚app官网
  • 免费网站空间哪个好2021拉新推广佣金排行榜
  • 论坛做视频网站有哪些百度灰色关键词排名技术
  • SOHO香港公司网站怎么做推广
  • 1.网站建设分为哪几个阶段seo网站优化做什么
  • 网站做sem推广时要注意什么石家庄seo报价
  • 兵团建设环保局门户网站北京网站建设开发公司
  • 包头网站 建设行业网站有哪些平台
  • 爱 做 网站识万物扫一扫
  • 定制购物平台seo关键词排名如何
  • 茂名手机网站建设公司名录免费b站推广网址有哪些
  • 如何用自己电脑做网站服务器吗现在的网络推广怎么做
  • 指定图片做logo网站拼多多怎么查商品排名
  • 做网站吸引客户2021近期时事新闻热点事件
  • 新泰网站开发制作网络优化大师
  • 网络服务端口哈尔滨关键词优化方式
  • 主机屋如何做网站赚钱平台
  • 10G网站空间百度app在哪里找
  • 武功县住房与城乡建设局网站学校seo推广培训班
  • 软件开发测试流程青岛seo整站优化招商电话
  • 怎样做付费下载的网站域名关键词排名查询
  • 合肥做网站web0551aso优化怎么做
  • 网站数据库怎么建立全球十大网站排名
  • 网站建设广州公司代运营公司怎么找客户
  • 线上教学网站怎么建设长沙网站优化培训
  • wordpress ui嘉兴seo外包平台
  • 网站开发 mvc百度快照怎么优化排名
  • wordpress 交互长沙网站seo推广