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

做淘宝网站用什么软件做如何设置淘宝友情链接

做淘宝网站用什么软件做,如何设置淘宝友情链接,大连做网站的网络公司,三蛋空间 wordpressvue 百度地图 使用 vue-baidu-map 进行当前位置定位和范围展示(考勤打卡) 一、创建百度地图账号,获取秘钥二、 引入插件1、安装vue-baidu-map2、在main.js中引入 三、 简单使用 最近写项目的时候,做到了考勤打卡的模块内容&#x…

vue 百度地图 使用 vue-baidu-map 进行当前位置定位和范围展示(考勤打卡)

  • 一、创建百度地图账号,获取秘钥
  • 二、 引入插件
    • 1、安装vue-baidu-map
    • 2、在main.js中引入
  • 三、 简单使用

最近写项目的时候,做到了考勤打卡的模块内容,需要选择考勤打卡的位置信息以及打卡的范围展,所以做出以下的记录,方便大家参考学习(如下图展示)

在这里插入图片描述

一、创建百度地图账号,获取秘钥

首先得有百度地图的账号,点此链接(百度地图)

二、 引入插件

1、安装vue-baidu-map

npm install vue-baidu-map --save

2、在main.js中引入

import Vue from 'vue'
import BaiduMap from 'vue-baidu-map'Vue.use(BaiduMap, {ak: '此处为百度地图申请的密钥'
})

三、 简单使用

以下就不多介绍了,直接上完整代码

// 引入
npm install vue-baidu-map --save

引入map.vue页面

// point传值  gainLocation 获取点位的信息
<map :point="point"  @gainLocation="gainLocation" ></map>data() {return {point:{"lng": 120.306731,  //坐标"lat": 31.581733, value:'三阳广场',    // 位置信息scope:50			// 范围}}},gainLocation(row){console.log(row)}

创建map.vue页面

<template><div><el-button @click="open">打开地图</el-button<el-dialog title="地图" :visible.sync="dialogs" v-if="dialogs" ><div><el-autocomplete style="width: 100%" :popper-append-to-body="false"v-model="value" :fetch-suggestions="querySearchAsync" :trigger-on-focus="false" placeholder="输入地址查找点位信息"@select="handleSelect" ><i slot="prefix" class="el-input__icon el-icon-search"></i><template slot-scope="{ item }"><div class="flexs"><i class="el-icon-location" style="font-size:25px;color:#409eff"></i><div style="margin-left:15px" class="flcol"><span style="color:#409eff;">{{ item.title }}</span><span style="color:#999">{{ item.address }}</span></div></div></template></el-autocomplete></div><div ><baidu-map class="map"  :center="circleCenter" :zoom="zoom" :scroll-wheel-zoom="true" @ready="handler" /></div><span slot="footer" class="dialog-footer"><el-button @click="subMit" type="primary">确 定</el-button><el-button @click="dialogs = false">取消</el-button></span></el-dialog></div>
</template><script>
import { BaiduMap, } from "vue-baidu-map";
export default {components: {BaiduMap,},props:['point'],data() {return {dialogs: false,value: '',circleCenter: { // 点位信息lng: 116.404,lat: 39.915},map: {},scope:50, // 范围zoom:20,  // 地图 视线大小circleStyle:{fillColor:"blue", strokeWeight: 1 ,fillOpacity: 0.3, strokeOpacity: 0.3},}},mounted() {//通过浏览器的Geolocation API获取经纬度if (navigator.geolocation) {navigator.geolocation.getCurrentPosition(this.showPosition);} else {console.log("Geolocation is not supported by this browser.");}},methods: {showPosition(position) {const latitude = position.coords.latitude;const longitude = position.coords.longitude;this.circleCenter = {lng: longitude,lat: latitude,};},handler({ BMap, map }) {let that = this// 此处是根据组件传递展示范围和定位信息 (根据自己要求更改)if (that.point) {that.circleCenter = {lng: that.point.lng,lat: that.point.lat}that.value = that.point.valuethat.scope = that.point.scopemap.centerAndZoom(new BMap.Point(that.circleCenter.lng, that.circleCenter.lat));var marks = new BMap.Marker(this.circleCenter); map.addOverlay(marks); var circle = new BMap.Circle(that.circleCenter,that.scope,that.circleStyle);map.addOverlay(circle);}that.map = map;var geocoder = new BMap.Geolocation(); //通过百度地图 创建地址解析器的实例   获取经纬度geocoder.getCurrentPosition(function (res) {var point = res.pointconst currentLocation = [res.longitude, res.latitude];console.log( "当前位置经纬度", currentLocation,res.address.province, res.address.city);if (!that.point) {var gc = new BMap.Geocoder(); gc.getLocation(point,function(rs){that.value = rs.address})that.circleCenter = {lng: currentLocation[0],lat: currentLocation[1],};map.centerAndZoom(new BMap.Point(currentLocation[0], currentLocation[1]));var marks = new BMap.Marker(point); map.addOverlay(marks); var circle = new BMap.Circle(that.circleCenter,that.scope,that.circleStyle);map.addOverlay(circle);}});},open() {this.dialogs = true},   querySearchAsync(str, cb) {var options = {onSearchComplete: function (res) {console.log(res,111);//检索完成后的回调函数var s = [];if (local.getStatus() == BMAP_STATUS_SUCCESS) {for (var i = 0; i < res.getCurrentNumPois(); i++) {s.push(res.getPoi(i));}cb(s); //获取到数据时,通过回调函数cb返回到<el-autocomplete>组件中进行显示} else {cb(s);}},};var local = new BMap.LocalSearch(this.map, options); //创建LocalSearch构造函数local.search(str); //调用search方法,根据检索词str发起检索console.log(str);},handleSelect(item) {let that = thisthat.value = item.address +'-' +item.title; //记录详细地址,含建筑物名that.circleCenter = { //记录当前选中地址坐标lng: item.point.lng,lat: item.point.lat,};that.map.clearOverlays(); //清除地图上所有覆盖物const marks = new BMap.Marker(item.point); //根据所选坐标重新创建Markerthat.map.addOverlay(marks); //将覆盖物重新添加到地图中that.map.panTo(item.point); //将地图的中心点更改为选定坐标点const circle = new BMap.Circle(that.circleCenter,that.scope,that.circleStyle);that.map.addOverlay(circle);},subMit(){const obj = { ...this.circleCenter,value:this.value }this.$alert(obj)this.$emit('gainLocation',obj)}}
}
</script><style scoped>
.map {margin-top: 20px;width: 100%;height: 300px;
}.flexs {display: flex;align-items: center;width: 100%;border-bottom: 1px solid #f5f5f5;
}
.flcol{display: flex;flex-direction: column;
}
</style>
http://www.15wanjia.com/news/15022.html

相关文章:

  • 响应式网站好么seo快速提升排名
  • 网站建设 报价单百度seo排名报价
  • 网站域名和邮箱域名平台推广营销
  • 创建企业营销网站包括哪些内容网络营销推广的方法有哪些
  • 这几年做哪些网站致富苏州百度推广服务中心
  • 怎么注册网站免费的深圳网站关键词
  • 做民宿加盟哪些网站比较好百度图片识别在线使用
  • wordpress弹出式插件轻松seo优化排名
  • 哪家做公司网站廊坊seo排名优化
  • 中山市做网站站长工具箱
  • php网站开发具体的参考文献图片百度搜索
  • 网站美工建设意见凡科网免费建站
  • 网站建设流程是这样的 里面有很国内能用的搜索引擎
  • 大学生网站设计作业动画深圳百度竞价托管公司
  • 广州公司摇号申请网站网络策划是做什么的
  • 网站建设费用多少钱抖音营销推广怎么做
  • 免费试用网站制作网络公司名字大全
  • wordpress创建数据库错误西安seo报价
  • wordpress禁用刘连康seo培训哪家强
  • 中文网站建设方案广告宣传语
  • 南昌seo网站sem和seo的区别
  • 大学生做网站类型南平网站seo
  • 做网站用到的软件网站的搜索引擎
  • 中国电子商务网站建设情况如何做优化排名
  • 创意合肥网站建设深圳网站公司排名
  • 江西省建设工程安全质量监督管理局网站百度号码认证平台个人号码申诉
  • 国家税务总局网页版seo快速排名多少钱
  • 汶上网站建设多少钱网络营销策划的目的
  • 可以找题目做的网站seo的基本内容
  • 织梦可以做微网站吗视频号怎么推广流量