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

外包网站制作sae 部署wordpress

外包网站制作,sae 部署wordpress,汕头住房与城乡建设网站,58同城免费发布信息写一篇文章来记录以下我在开发小程序地图过程中遇到的两个小坑吧,一个是点聚合,用的是joinCluster这个指令,另一个是polygon在地图上划分多边形的问题: 1.首先说一下点聚合问题,由于之前没有做过小程序地图问题&#…

写一篇文章来记录以下我在开发小程序地图过程中遇到的两个小坑吧,一个是点聚合,用的是joinCluster这个指令,另一个是polygon在地图上划分多边形的问题:

1.首先说一下点聚合问题,由于之前没有做过小程序地图问题,所以浏览了很多资料,最终发现看的多了反而杂乱,而且这次要完成的不是地图单点定位或者地图导航,而是地图撒点,在地图上要显示很多定位点,那么点数过多且覆盖就成了一个要解决的问题,我上网搜了大量的资料,要么自己手写,要么引入很多其它组件方式看起来比较复杂,直接说最简单的结论,在撒的markers点内部直接加一个joinCluster: true即可,藏在官方文档marker介绍下的最下面:

 

然后最坑的来了,加了这个之后会发现微信开发者工具里面缩放地图并没有反应,无论缩放地图与否,都不会聚合,实际上这是开发者工具的问题,它是一个模拟器不能完全实现手机小程序上的所有功能,这时候如果打开真机调试或者二维码预览即可发现点聚合功能是可以实现的,下面给大家一段代码:

<template><view class="base_body"><map :markers="markers" id="map1" style="width: 100%; height: 100vh;" :latitude="latitude":longitude="longitude"><cover-view slot="callout"><block v-for="(item,index) in markers" :key="index"><cover-view class="customCallout" :marker-id="item.id"><cover-view class="content">{{item.title}}</cover-view></cover-view></block></cover-view></map></view>
</template><script>export default {data() {return {map: '',latitude: 39.890, // 地图默认显示的维度longitude: 116.39752, // 地图默认显示的纬度markers: [{ // 标记点id: 1,latitude: 39.890,longitude: 116.39752,title: "点击提示1",joinCluster: true,}, {id: 2,latitude: 39.891,longitude: 116.39752,title: "点击提示2",joinCluster: true,}, {id: 3,latitude: 39.892,longitude: 116.39752,title: "点击提示3",joinCluster: true,}, {id: 4,latitude: 39.893,longitude: 116.39752,title: "点击提示4",joinCluster: true,}, ],}},onLoad() {},onReady() {},methods: {}}
</script><style>.base_body {width: 100%;height: 100%;position: absolute;}/* 水平,垂直居中 */.base_all_center {justify-content: center;align-items: center;}/* 垂直居中 */.base_center_vertical {display: flex;align-items: center;}/* 水平居中 */.base_center_horizontal {display: flex;justify-content: center;}/* 垂直布局 */.base_column {display: flex;flex-direction: column;}/* 横向布局 */.base_row {display: flex;flex-direction: row;}/* 基础dialog */.base_dialog {width: 100%;height: 100%;position: absolute;top: 0px;background: rgba(0, 0, 0, 0.5);}.customCallout {box-sizing: border-box;background-color: #fff;border: 1px solid #ccc;border-radius: 30px;width: 150px;height: 40px;display: inline-flex;padding: 5px 20px;justify-content: center;align-items: center;}.content {flex: 0 1 auto;margin: 0 10px;font-size: 14px;}
</style>

这一段代码不需要有任何修改,直接新建一个demo页面然后复制进去直接运行到微信小程序,之后启动真机调试即可发现点聚合功能是实现了的,更多细节大家可以自行了解。

2.第二个问题是划分多边形的问题,我查阅了微信官方文档上面说使用polygon即可:

 于是我使用了,但是无论我怎么填写数据都没用,一度怀疑自我,这时候发现还是要以uni-app官方文档为准,我死磕微信开发文档导致自己怀疑自我,两者有所区别,这是uni-app官方文档的介绍:

 没错,uni-app官方文档显示应该加一个s,用的是polygons,所以仅仅加一个s即可,非常搞心态,而且即使是uni-app官网下方对于这个的介绍也没加s:

下面也给大家一段代码是划了一个多边形,和上面一样,直接复制代码进去运行即可,不需要修改其它东西 :

<template><view class="base_body"><map :polygons="polygon" id="map1" style="width: 100%; height: 100vh;" :latitude="latitude":longitude="longitude"><cover-view slot="callout"><block v-for="(item,index) in markers" :key="index"><cover-view class="customCallout" :marker-id="item.id"><cover-view class="content">{{item.title}}</cover-view></cover-view></block></cover-view></map></view>
</template><script>export default {data() {return {map: '',latitude: 39.890, // 地图默认显示的维度longitude: 116.39752, // 地图默认显示的纬度polygon: [{points: [{latitude: 39.890,longitude: 116.39752},{latitude: 39.891,longitude: 116.39852},{latitude: 39.892,longitude: 116.39852},{latitude: 39.893,longitude: 116.39752},],strokeWidth: "2",strokeColor: "#2223FD",fillColor: "#9FA4F6"}, ],}},}
</script><style>.base_body {width: 100%;height: 100vh;position: absolute;}/* 水平,垂直居中 */.base_all_center {justify-content: center;align-items: center;}/* 垂直居中 */.base_center_vertical {display: flex;align-items: center;}/* 水平居中 */.base_center_horizontal {display: flex;justify-content: center;}/* 垂直布局 */.base_column {display: flex;flex-direction: column;}/* 横向布局 */.base_row {display: flex;flex-direction: row;}/* 基础dialog */.base_dialog {width: 100%;height: 100%;position: absolute;top: 0px;background: rgba(0, 0, 0, 0.5);}.customCallout {box-sizing: border-box;background-color: #fff;border: 1px solid #ccc;border-radius: 30px;width: 150px;height: 40px;display: inline-flex;padding: 5px 20px;justify-content: center;align-items: center;}.content {flex: 0 1 auto;margin: 0 10px;font-size: 14px;}
</style>

最终结果就是显示一块多边形:

先说这么多,后续遇到什么问题我会继续上传的,诸君共勉。

http://www.yayakq.cn/news/250384/

相关文章:

  • 网站开发后端开发杭州网站建设长春公司
  • 网站一年多少钱阳江兼职招聘网最新招聘
  • 网站开发及技术越南网站 后缀
  • 怎么在网上注册自己的网站网站标签管理
  • 电商网站设计公司可找亿企邦如何利用云服务器进行网站建设
  • 广东智能网站建设哪家有网站建设的知识和技能
  • 厦门市市场开发建设服务中心网站哪里可以免费发布招聘信息
  • 建设银行杭州招聘网站诸城建设局网站
  • 企业做网站用什么建站系统wordpress删除导入xml
  • 汕头快速建站模板网站 域名到期
  • 网站设计开发是啥北京公司注册中介正规
  • 电子网站建设价格seo培训师招聘
  • 水友做的yyf网站工商局注册公司网站
  • 制作网站设计的公司公司做网站的价格几千元
  • 自己怎么做单页网站今天重要新闻
  • 做一个网站难不难客户关系管理名词解释
  • 赣州网站制作找哪家好wordpress虚拟交易模板
  • 秀山网站建设端午节手抄报获奖希爱力副作用太强了
  • 受雇去建设网站类网站莆田有哪些网站建设公司
  • 自己建网站需要备案吗wordpress在手机版
  • 柳州市住房和城乡建设局网站首页学网页设计有用吗
  • 网站建设意向书wordpress 登入
  • 网站平台推广有哪些网站开发工程师任职要求
  • 有哪些做海报的网站查询战网
  • 惠州做网站优化机械加工网配件销售网
  • 漂亮网站山西省网站
  • 湛江做网站的网站鞍山58同城二手房
  • 辽宁网站推广门户型网站有哪些
  • 东莞市网站建设制作设计平台专门做活动的网站
  • 临沧永德网站建设电子商务公司注册公司流程和费用注册资金