# add transfer plan

This commit is contained in:
xianfuxing 2018-09-02 23:37:02 +08:00
parent a75bcabf86
commit 97af9a4e6a
2 changed files with 32 additions and 9 deletions

View File

@ -11,6 +11,6 @@
<!-- <script src=<%= htmlWebpackPlugin.options.path %>/tinymce4.7.5/tinymce.min.js></script> --> <!-- <script src=<%= htmlWebpackPlugin.options.path %>/tinymce4.7.5/tinymce.min.js></script> -->
<div id="app"></div> <div id="app"></div>
<!-- built files will be auto injected --> <!-- built files will be auto injected -->
<script type="text/javascript" src="https://webapi.amap.com/maps?v=1.4.8&key=49842c6fe4d24df80871faec2e272a00"></script> <script type="text/javascript" src="https://webapi.amap.com/maps?v=1.4.8&key=49842c6fe4d24df80871faec2e272a00&plugin=AMap.Transfer"></script>
</body> </body>
</html> </html>

View File

@ -1,6 +1,7 @@
<template> <template>
<div class="app-container"> <div class="app-container">
<div id="map-container" tabindex="0"></div> <div id="map-container" tabindex="0"></div>
<div id="panel"></div>
</div> </div>
</template> </template>
@ -159,16 +160,28 @@ export default {
this.coordinate = [113.203460828994, 22.64902452257] this.coordinate = [113.203460828994, 22.64902452257]
} }
const map = new AMap.Map('map-container', { const map = new AMap.Map('map-container', {
center: this.coordinate, // center: this.coordinate,
center: [116.397428, 39.90923],
resizeEnable: true, resizeEnable: true,
zoom: 16 zoom: 13
})
new AMap.Marker({
position: this.coordinate,
zIndex: 10,
title: this.deviceList[0].title,
map: map
}) })
// new AMap.Marker({
// position: this.coordinate,
// zIndex: 10,
// title: this.deviceList[0].title,
// map: map
// })
const transOptions = {
map: map,
city: '北京市',
panel: 'panel',
// cityd:'',
policy: AMap.TransferPolicy.LEAST_TIME
}
//
const transfer = new AMap.Transfer(transOptions)
// 线
transfer.search(new AMap.LngLat(116.291035, 39.907899), new AMap.LngLat(116.427281, 39.903719))
}) })
} }
}, },
@ -250,4 +263,14 @@ export default {
position: relative; position: relative;
z-index: 104; z-index: 104;
} }
#panel {
position: absolute;
background-color: white;
max-height: 80%;
overflow-y: auto;
top: 10px;
right: 10px;
width: 250px;
border: solid 1px silver;
}
</style> </style>