## 地图
![](https://box.kancloud.cn/bd6150a45843a528d0dbb02b1faceeac_1106x493.png)
[TOC]
### 1.基本配置
****
****
### 2.map页面编写
#### map.wxml
```
<map id="map" longitude="{{longitude}}" latitude="{{latitude}}" scale="25" markers="{{markers}}" circles='{{circles}}' bindmarkertap='marker'></map>
```
>1.经纬度 longitude和latitude使用插值表达式{{ }}写入动态数据
2.scale 比例尺
3.markers 为地图添加红色标记,详见map.js > markers
4.circles 为地图添加范围圈,详见map.js > circles
5.bindmarkertap='marker'为markers添加点击事件,使callout出现,详见map.js > callout
[map微信官方更多设置](https://developers.weixin.qq.com/miniprogram/dev/component/map.html)
[腾讯地图-坐标拾取器](https://lbs.qq.com/tool/getpoint/)
****
#### map.wxss
```
page{
height: 100%;
}
#map{
width: 100%;
height: 40%;
}
```
****
#### map.js
##### 经纬度设置
```
Page({
data:{
latitude: 30.591110,
longitude: 114.365920,
```
##### circles
```
circles: [{
latitude: 30.591110,
longitude: 114.365920,
fillColor: "#12345699",
radius:30
}],
```
>设置 纬度、经度、填充颜色、半径
##### markers
```
markers: [{
iconPath: "/images/地图.png",
latitude: 30.591110,
longitude: 114.365920,
width: 30,
height: 30,
id:0,
title:"爱家国际华城",
```
>设置标记的icon地址、纬度、经度、图标大小
**id、title必须添加,没有id后面的callout气泡无法显示**
##### label(label属性包裹在markers里)
```
label:{
content:"爱家国际华城",
color:"#ee5e7b",
borderWidth:2,
borderColor:"#ee5e7b",
borderRadius:5,
padding:5,
},
>设置标签的内容、字体颜色、边框宽度、边框颜色、边框圆角弧度、文本内容与边框的距离
```
##### callout(callout属性包裹在markers里)
```
callout:{
content:"爱家国际华城",
color:"#ee5e7b",
bgColor:"#fff",
borderWidth:2,
borderColor:"#ee5e7b",
borderRadius:5,
padding:5,
}
}]
},
marker(){
}
})
```
>设置内容大致与label相同,可更改bgColor背景颜色
marker(){}函数调用
- 项目启动配置
- 01.欢迎页
- 03.点击图片切换——事件绑定bindtap、catchtap
- 04.底方分页切换tabBar
- 20.音乐播放
- 06.豆瓣电影列表
- 1.App
- 2.template
- 3.movies-detail 页面详情
- 组件
- 02.地图
- 05.轮播图swiper
- 07.点击预览图片previewImage结合scroll-view
- 11.web-page
- 14.form表单
- 08.头像图片更换chooseImage
- 09.上拉刷新OnReachBottom
- 10.使用缓存(收藏、分享状态)
- 12.导航条加载、页面加载、导航标题设置
- 13.弹出框
- 15.demo
- data
- local.js
- pages
- welcome(欢迎页)
- index
- index.wxml
- index.wxss
- index.js
- index-detail
- index-detail.wxml
- index-detail.wxss
- index-detail.js
- template
- yuedu-list.wxml
- yuedu-list.wxss
- map
- movies
- movies.wxml
- movies.wxss
- movies.js
- movies-grid
- movies-grid-template.wxml
- movies-grid-template.wxss
- movies-item
- movies-item-template.wxml
- movies-item-template.wxss
- movies-more
- movies-more.wxml
- movies-more.wxss
- movies-more.js
- movie-detail
- movie-detail.wxss
- movie-detail.wxml
- movie-detail.js
- star
- star-template.wxml
- star-template.wxss
- web-page
- web-page.wxml
- web-page.js
- post-img
- post-img.wxml
- post-img.js
- post-img.wxss
- 演员列表图
- 列表图.wxml
- 列表图.wxss
- 列表图.js
- utils
- utils.js
- app.js
- app.json
- app.wxss
- 16.事件冒泡
- 18.Tip
- 框架
- 17.模板
- 19.组件模板和样式(slot)
- component构造器
- 组件事件
- behaviors
- wxs
- HTTP封装
- models使用封装HTTP
- 更多有关promise封装的例子
- 生命周期
- 注意: