# up item
This commit is contained in:
parent
f452de76cd
commit
5d68f72890
|
@ -6,6 +6,7 @@
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import AMap from 'AMap'
|
import AMap from 'AMap'
|
||||||
|
import moment from 'moment'
|
||||||
export default {
|
export default {
|
||||||
name: 'map2',
|
name: 'map2',
|
||||||
data() {
|
data() {
|
||||||
|
@ -87,7 +88,7 @@ export default {
|
||||||
title: item.title,
|
title: item.title,
|
||||||
map: this.map
|
map: this.map
|
||||||
})
|
})
|
||||||
const infoWindow = this.instantiateInforWindow(item.title)
|
const infoWindow = this.instantiateInforWindow(item)
|
||||||
AMap.event.addListener(marker, 'click', () => {
|
AMap.event.addListener(marker, 'click', () => {
|
||||||
infoWindow.open(this.map, marker.getPosition())
|
infoWindow.open(this.map, marker.getPosition())
|
||||||
})
|
})
|
||||||
|
@ -134,19 +135,20 @@ export default {
|
||||||
sharp.src = 'https://webapi.amap.com/images/sharp.png'
|
sharp.src = 'https://webapi.amap.com/images/sharp.png'
|
||||||
bottom.appendChild(sharp)
|
bottom.appendChild(sharp)
|
||||||
info.appendChild(bottom)
|
info.appendChild(bottom)
|
||||||
console.log(info)
|
// console.log(info)
|
||||||
return info
|
return info
|
||||||
},
|
},
|
||||||
instantiateInforWindow(title) {
|
instantiateInforWindow(item) {
|
||||||
const content = []
|
const content = []
|
||||||
content.push('<div class="count">339</div>')
|
const curTime = moment().format('YYYY-MM-DD HH:mm:ss')
|
||||||
content.push('<div class="time">时间:2018年5月15日 14:33:25</div>')
|
content.push('<div class="count">' + item.count + '</div>')
|
||||||
content.push('<div><span>信号:23</span><span class="energy">电量:4233</span></div>')
|
content.push('<div class="time">时间:' + curTime + '</div>')
|
||||||
|
content.push('<div><span>信号:' + item.signal + '</span><span class="energy">电量:' + item.energy + '</span></div>')
|
||||||
content.push('<div>区域:尖沙咀</div>\n')
|
content.push('<div>区域:尖沙咀</div>\n')
|
||||||
const infoWindow = new AMap.InfoWindow({
|
const infoWindow = new AMap.InfoWindow({
|
||||||
isCustom: true,
|
isCustom: true,
|
||||||
closeWhenClickMap: true,
|
closeWhenClickMap: true,
|
||||||
content: this.createInfoWindow(title, content.join('\n')),
|
content: this.createInfoWindow(item.title, content.join('\n')),
|
||||||
offset: new AMap.Pixel(16, -45)
|
offset: new AMap.Pixel(16, -45)
|
||||||
})
|
})
|
||||||
return infoWindow
|
return infoWindow
|
||||||
|
@ -209,7 +211,7 @@ export default {
|
||||||
margin: 0 0 .4rem 0;
|
margin: 0 0 .4rem 0;
|
||||||
}
|
}
|
||||||
.info-middle span.energy {
|
.info-middle span.energy {
|
||||||
margin-left: 2rem;
|
margin-left: 1.8rem;
|
||||||
}
|
}
|
||||||
div.info-bottom {
|
div.info-bottom {
|
||||||
height: 0px;
|
height: 0px;
|
||||||
|
|
Loading…
Reference in New Issue