uniapp实现地图电子围栏功能

该功能使用uniapp中内置组件map实现

效果图预览:

实现过程:

1.文档:

2.代码:

复制代码
<template>
	<view>
		<map :style="'width: 100%;'+ 'height:'+screenHeight" :latitude="latitude" :longitude="longitude"
			:polygons="polygons" :markers="markerList">
		</map>
		<switch color="#FFCC33" style="transform:scale(0.8)" @change="switch1Change" :checked="ched"/>
	</view>
</template>
<script>
	export default {
		data() {
			return {
				ched:true,
				"longitude": 116.44053,
				"latitude": 39.960038,
				screenHeight: '400px',
				markerList: [{
					"id": 1,
					"longitude": 116.440529,
					"latitude": 39.960026,
					"iconPath": '../../static/dian.png',
					"width": "80rpx",
					"height": "80rpx"
				}],
				polygons: [{
					//多边形的坐标数组
					points: [{
						"longitude": 116.439688,
						"latitude": 39.961146
					}, {
						"longitude": 116.439697,
						"latitude": 39.959854
					}, {
						"longitude": 116.441444,
						"latitude": 39.959863
					}, {
						"longitude": 116.441467,
						"latitude": 39.959979
					}, {
						"longitude": 116.441448,
						"latitude": 39.960049
					}, {
						"longitude": 116.439756,
						"latitude": 39.961175
					}],
					fillColor: "#cbdde9", //填充颜色
					strokeColor: "#78addd", //描边颜色
					strokeWidth: 2, //描边宽度
					zIndex: 1, //层级
				}]
			}
		},
		methods: {
			
		}
	}
</script>

<style>

</style>
相关推荐
脾气有点小暴3 小时前
scroll-view分页加载
前端·javascript·uni-app
脾气有点小暴6 小时前
uniapp自定义头部导航
前端·uni-app
前端 贾公子11 小时前
[uniapp][swtich开关]阻止切换状态(类似阻止事件冒泡)
uni-app
雪芽蓝域zzs14 小时前
uniapp基于picker选择器实现年月日时分秒
uni-app
niucloud-admin15 小时前
本地开发部署——uniapp端站点部署
uni-app
毕设源码-郭学长2 天前
【开题答辩全过程】以 基于uni-app的维修上门服务小程序设计与实现为例,包含答辩的问题和答案
uni-app
xiaohe06012 天前
📦 Uni ECharts 是如何使用定制 echarts 的?一篇文章轻松掌握!
vue.js·uni-app·echarts
Front思2 天前
uniapp实现物流节点
uni-app
赵庆明老师2 天前
uniapp 微信小程序页面JS模板
javascript·微信小程序·uni-app
熬耶2 天前
uniapp 简单实现列表左滑操作
uni-app