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

公司注册地址要求东莞网站优化推广

公司注册地址要求,东莞网站优化推广,seo百度排名优化,微信小程序平台官网登录入口uniapp地图使用 App端 通过 nvue 页面实现地图 文章目录 uniapp地图使用效果图templatejs添加 marker使用地图查看位置移到到当前位置 效果图 template <template><view class"mapWrap"><!-- #ifdef APP-NVUE --><map class"map-containe…

uniapp地图使用

App端 通过 nvue 页面实现地图

文章目录

    • uniapp地图使用
      • 效果图
      • template
      • js
        • 添加 marker
        • 使用地图查看位置
        • 移到到当前位置

效果图

在这里插入图片描述


template

<template><view class="mapWrap"><!-- #ifdef APP-NVUE --><map class="map-container" id="map" :longitude="location.lng" :latitude="location.lat" :show-location="true" :enable-3D="enable3D" :markers="markers" :include-points="includePoints" @callouttap="oncallouttap"></map><!-- 定位当前位置 --><cover-view class="myLocation fcc"><cover-image class="img" src="@/static/image/icon/currnet_location.png" @click="moveToMyLocation"></cover-image></cover-view><!-- #endif --></view>
</template>

js

添加 marker
使用地图查看位置
移到到当前位置
<script>export default {data() {return {location: {lng: 114.058279,lat: 22.505375},markers: [],includePoints: []}},onLoad() {let tmpLocation = this.$store.state.location;if (tmpLocation.lng) {this.location = tmpLocation;}},onReady() {this.map = uni.createMapContext("map", this);},methods: {getData() {// ....// 测试数据this.dataList = [{name: "长安街",location: {lat: 39.907145,lng: 116.396651}},{name: "天安门",location: {lat: 39.908823,lng: 116.39747}}]// 添加 markerthis.addMarkers();},/*** 添加marker*/addMarkers() {let markerList = [];this.batteryList.forEach((item, index) => {let location = item.location;if (location) {// 直接使用 this.markers.push()方式,无法添加 markermarkerList.push({id: Number(index + 1),latitude: Number(location.lat),longitude: Number(location.lng),title: item.name,zIndex: '1',rotate: 0,width: 30,height: 30,anchor: {x: 0.5,y: 1},callout: {content: item.name,color: '#fff',fontSize: 10,borderRadius: 4,borderWidth: 1,borderColor: '#fb6620',bgColor: '#f7b733',padding: '5',display: 'ALWAYS'},iconPath: '/static/image/icon/location01.png'})}this.markers = markerList;})},/*** 气泡事件*/oncallouttap(e) {const { markerId } = e.detail;const marker = this.markers.find((item) => item.id === markerId);// 使用地图查看位置uni.openLocation({latitude: marker.latitude,longitude: marker.longitude,name: marker.title,success: (res) => {console.log('success');}});},/*** 移到到当前位置*/moveToMyLocation() {let latitude = this.location.lat;let longitude = this.location.lng;this.map.moveToLocation({latitude,longitude,success: (res) => {this.includePoints = [{latitude,longitude}];}});}}}
</script>
http://www.yayakq.cn/news/142902/

相关文章:

  • 郑州网站建设易云巢上海建智建设工程咨询
  • 大数据与网站开发技术哈尔滨建站系统点击查看
  • 哪些企业网站使用水墨风格彩票网站建设多少钱
  • jQuery EasyUI网站开发实战wordpress前台漏洞
  • 织梦旅游网站wordpress评论框函数
  • wordpress多域名多站点快速建设房产网站
  • 企业电子商务网站建设的重要性wordpress资料分享网站
  • 网站搜索要怎么做wordpress用qq注册
  • 做网站网站需要注意什么如何关闭网站
  • 长春做网站的电话佛山销售型网站建设
  • 网站开发实验报告上海建网站的公司
  • 网站开发人员考核指标非常酷的wordpress主题
  • 网站名称怎么备案学生管理系统网站
  • 连云港营销型网站建设互联网外包平台
  • 程序员给别人做的网站违法了微信小程序安装
  • 建站公司是什么意思苏州实力做网站公司有哪些
  • 自助建网站平台怎么收费外包加工网免押金
  • 新乡做网站优化啦啦啦中文免费视频高清观看
  • 石景山做网站公司wordpress 文章链接失效
  • 网站模板 静态模版韩国世界杯小组赛出线
  • 北京网站制作公司建站wordpress 批量建站
  • 成品软件源码网站大全做外贸有哪些好的网站有哪些
  • 网站建设与管理试题答案网站建设运营公司大全
  • 企业网站推广推广阶段wordpress域名修改后
  • 公司网站建设的视频wordpress好用主题
  • 常州自助做网站做标记网站
  • 在本地做的网站怎么修改域名泰安人才招聘网最新招聘2023
  • 做介绍的英文网站公司做网站需要准备什么软件
  • 电商网站开发需要多少钱网站后台管理系统登陆
  • 怎么投诉没有备案就已经运营网站域度设计网站