之前写了一篇文章也是连点成线的,但是那个方法点数多了以后会出现卡顿问题,现做了改进,以此记录
<template>
<el-dialog title="查看司机路线图" :close-on-click-modal="true" :close-on-press-escape="true" :show-close="true" :visible.sync="visible">
<div class="mod-user">
<div style="width:100%;height:500px;border:1px solid gray" id="mapId"></div>
</div>
</el-dialog>
</template>
<script type="text/javascript" src="http://api.map.baidu.com/api?v=2.0&ak=wIt2mDCMGWRIi2pioR8GZnfrhSKQHzLY"></script>
<script>
export default {
data(){
return{
visible: true,
PointArr:[
{
lat: 36.10339957700999, lng: 120.4207801005104},
{
lat: 36.10349055332635,lng: 120.42113539348455},
{
lat: 36.10370795896673,lng: 120.42162977768736},
{
lat: 36.10411490190429,lng: 120.42166901055167},
{
lat: 36.104232027406695,lng: 120.42185015059275},
{
lat: 36.10425620255758,lng: 120.42202022562539},
{
lat: 36.104265908631284,lng: 120.42208225102176},
{
lat: 36.104399968669526,lng: 120.42187425183421},
{
lat: 36.10452708476511,lng: 120.42076268466177},
{
lat: 36.10480132817409, lng: 120.4196557913201},
{
lat: 36.10560773716036,lng: 120.418951386886},
{
lat: 36.10621159088823,lng: 120.41900182905378},
{
lat: 36.1064641068988,lng: 120.41992809616544},
{
lat: 36.10679444086644,lng: 120.42102125032955},
{
lat: 36.107010189089046,lng: 120.42182982905027},