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>
相关推荐
林涧泣12 小时前
【Uniapp-Vue3】解决uni-popup弹窗在安全区显示透明问题
前端·vue.js·uni-app
寰宇软件2 天前
PHP场馆预定系统小程序
小程序·uni-app·vue·php
林涧泣3 天前
【Uniapp-Vue3】触底加载更多
uni-app
新青年.3 天前
【uniapp】uniapp使用java线程池
javascript·uni-app
答题卡上的情书3 天前
uniapp版本升级
前端·javascript·uni-app
向明天乄3 天前
uniapp 地图添加,删除,编辑标记,在地图中根据屏幕范围中呈现标记
android·java·uni-app
大叔_爱编程3 天前
wx044基于springboot+vue+uniapp的智慧物业平台小程序
vue.js·spring boot·小程序·uni-app·毕业设计·源码·课程设计
林涧泣3 天前
【Uniapp-Vue3】图片lazy-load懒加载
uni-app
大叔_爱编程5 天前
wx043基于springboot+vue+uniapp的智慧物流小程序
vue.js·spring boot·小程序·uni-app·毕业设计·源码·课程设计
林涧泣6 天前
【Uniapp-Vue3】StorageSync数据缓存API
前端·javascript·uni-app