最新国产好看的视频,伊人天堂AV在线,国产Aaaaaa视频,蜜臀视频在线观看一区,人妻av色图,密臀久久久精品影片,青青视频免费观看毛片,久草在线观看视,国产三级精品色情在线

Vue中的高德軌跡回放

 更新時(shí)間:2023年03月27日 14:28:12   作者:半度納  
這篇文章主要介紹了Vue中的高德軌跡回放問題,具有很好的參考價(jià)值,希望對大家有所幫助。如有錯(cuò)誤或未考慮完全的地方,望不吝賜教

高德地圖實(shí)現(xiàn)軌跡回放的方式之一:使用高德地圖官方api中UI組件庫中的軌跡展示。

通過軌跡展示創(chuàng)建巡航器,實(shí)現(xiàn)軌跡回放,下面展示HTML以及Vue的高德軌跡回放,可以點(diǎn)擊下方鏈接直接進(jìn)入高德開發(fā)平臺!

高德開放平臺

HTML版高德軌跡回放

進(jìn)入頁面后點(diǎn)擊開發(fā)支持→地圖JS API

 進(jìn)入地圖JS API后點(diǎn)擊示例中心,進(jìn)入界面后拉到底下找到軌跡回放

 

進(jìn)入后打開軌跡回放如下圖中已有示例,模擬小車的行駛軌跡。其模擬的軌跡為右側(cè)框圖的小車模擬位置點(diǎn), 將自己獲取的經(jīng)緯度點(diǎn)替代上面提到的小車模擬位置點(diǎn)即可驗(yàn)證自己設(shè)備輸出的GPS位置的準(zhǔn)確性。(注意:此頁面代碼為HTML格式

Vue版高德軌跡回放

代碼

<template>
	<div>
	    <div id="container"></div>
	    <div class="input-card">
	      <h4>軌跡回放控制</h4>
	      <div class="input-item">
	        <input type="button" class="btn" value="開始動(dòng)畫" id="start" @click="startAnimation()" />
	        <input type="button" class="btn" value="暫停動(dòng)畫" id="pause" @click="pauseAnimation()" />
	      </div>
	      <div class="input-item">
	        <input type="button" class="btn" value="繼續(xù)動(dòng)畫" id="resume" @click="resumeAnimation()" />
	        <input type="button" class="btn" value="停止動(dòng)畫" id="stop" @click="stopAnimation()" />
	      </div>
	    </div>
	  </div>
</template>
<script type="text/javascript" src="https://webapi.amap.com/maps?v=1.4.15&key=您申請的key值"></script>
<script>
	//請求路徑
	//import {
		//playbacklist,
	//} from "@/api/obd/playback";
 
	export default {
	    mounted() {
	      this.initMap();
	    },
	    beforeDestroy() {
	      this.map && this.map.destroy();
	    },
	    data() {
	      return {
	        map: null,
	        marker: null,
	        lineArr: [
	          [116.478935, 39.997761],
	          [116.478939, 39.997825],
	          [116.478912, 39.998549],
	          [116.478912, 39.998549],
	          [116.478998, 39.998555],
	          [116.478998, 39.998555],
	          [116.479282, 39.99856],
	          [116.479658, 39.998528],
	          [116.480151, 39.998453],
	          [116.480784, 39.998302],
	          [116.480784, 39.998302],
	          [116.481149, 39.998184],
	          [116.481573, 39.997997],
	          [116.481863, 39.997846],
	          [116.482072, 39.997718],
	          [116.482362, 39.997718],
	          [116.483633, 39.998935],
	          [116.48367, 39.998968],
	          [116.484648, 39.999861]
	        ]
	      };
	    },
	    methods: {
	      initMap() {
	        this.map = new AMap.Map("container", {
	          resizeEnable: true,
	          center: [116.397428, 39.90923],
	          zoom: 17
	        });
	
	        this.marker = new AMap.Marker({
	          map: this.map,
	          position: [116.478935, 39.997761],
	          icon: "https://webapi.amap.com/images/car.png",
	          offset: new AMap.Pixel(-26, -15),
	          autoRotation: true,
	          angle: -90
	        });
	
	        // 繪制軌跡
	        let polyline = new AMap.Polyline({
	          map: this.map,
	          path: this.lineArr,
	          showDir: true,
	          strokeColor: "#28F", //線顏色
	          // strokeOpacity: 1,     //線透明度
	          strokeWeight: 6 //線寬
	          // strokeStyle: "solid"  //線樣式
	        });
	
	        let passedPolyline = new AMap.Polyline({
	          map: this.map,
	          // path: this.lineArr,
	          strokeColor: "#AF5", //線顏色
	          // strokeOpacity: 1,     //線透明度
	          strokeWeight: 6 //線寬
	          // strokeStyle: "solid"  //線樣式
	        });
	
	        this.marker.on("moving", function (e) {
	          passedPolyline.setPath(e.passedPath);
	        });
	
	        this.map.setFitView();
	      },
	      startAnimation() {
	        this.marker.moveAlong(this.lineArr, 200);
	      },
	      pauseAnimation() {
	        this.marker.pauseMove();
	      },
	      resumeAnimation() {
	        this.marker.resumeMove();
	      },
	      stopAnimation() {
	        this.marker.stopMove();
	      }
	    }
	  };
</script>
<style lang="less" scoped>
	// @import url('https://a.amap.com/jsapi_demos/static/demo-center/css/demo-center.css');
	
	  #container {
	    height: 1000px;
	    width: 100%;
	  }
	
	  .input-card .btn {
	    margin-right: 1.2rem;
	    width: 9rem;
	  }
	
	  .input-card .btn:last-child {
	    margin-right: 0;
	  }
	  
	  .btn {
	    display: inline-block;
	    font-weight: 400;
	    text-align: center;
	    white-space: nowrap;
	    vertical-align: middle;
	    -webkit-user-select: none;
	    -moz-user-select: none;
	    -ms-user-select: none;
	    user-select: none;
	    border: 1px solid transparent;
	    transition: color .15s ease-in-out, background-color .15s ease-in-out, border-color .15s ease-in-out, box-shadow .15s ease-in-out;
	    background-color: transparent;
	    background-image: none;
	    color: #25A5F7;
	    border-color: #25A5F7;
	    padding: .25rem .5rem;
	    line-height: 1.5;
	    border-radius: 1rem;
	    -webkit-appearance: button;
	    cursor:pointer;
	  }
	  
	  .input-item {
	    position: relative;
	    display: -ms-flexbox;
	    display: flex;
	    -ms-flex-wrap: wrap;
	    flex-wrap: wrap;
	    -ms-flex-align: center;
	    align-items: center;
	    width: 100%;
	    height: 3rem;
	  }
	  
	  .input-card {
	    display: flex;
	    flex-direction: column;
	    min-width: 0;
	    word-wrap: break-word;
	    background-color: #fff;
	    background-clip: border-box;
	    border-radius: .25rem;
	    width: 22rem;
	    border-width: 0;
	    border-radius: 0.4rem;
	    box-shadow: 0 2px 6px 0 rgba(114, 124, 245, .5);
	    position: fixed;
	    bottom: 1rem;
	    right: 1rem;
	    -ms-flex: 1 1 auto;
	    flex: 1 1 auto;
	    padding: 0.75rem 1.25rem;
	  }
</style>

常見問題

啟動(dòng)時(shí)會(huì)遇到Module not found: Error: Can’t resolve ‘less-loader’ in '文件位置’報(bào)錯(cuò)

原因是因?yàn)?less 、 less-loader模塊未安裝,但在中進(jìn)行使用

解決方法:npm install --save-dev less-loader less

直接安裝可能會(huì)存在版本太高問題的報(bào)錯(cuò),進(jìn)行npm run dev時(shí)項(xiàng)目無法啟動(dòng)

解決方法:npm install less-loader@5.0.0 -D 可在版本位置選擇合適的版本

總結(jié)

以上為個(gè)人經(jīng)驗(yàn),希望能給大家一個(gè)參考,也希望大家多多支持腳本之家。

相關(guān)文章

  • 使用sessionStorage解決vuex在頁面刷新后數(shù)據(jù)被清除的問題

    使用sessionStorage解決vuex在頁面刷新后數(shù)據(jù)被清除的問題

    localStorage沒有時(shí)間期限,除非將它移除,sessionStorage即會(huì)話,當(dāng)瀏覽器關(guān)閉時(shí)會(huì)話結(jié)束,有時(shí)間期限,具有自行百度。本文使用的是sessionStorage解決vuex在頁面刷新后數(shù)據(jù)被清除的問題,需要的朋友可以參考下
    2018-04-04
  • Antd的Table組件嵌套Table以及選擇框聯(lián)動(dòng)操作

    Antd的Table組件嵌套Table以及選擇框聯(lián)動(dòng)操作

    這篇文章主要介紹了Antd的Table組件嵌套Table以及選擇框聯(lián)動(dòng)操作,具有很好的參考價(jià)值,希望對大家有所幫助。一起跟隨小編過來看看吧
    2020-10-10
  • Vue核心概念A(yù)ction的總結(jié)

    Vue核心概念A(yù)ction的總結(jié)

    今天小編就為大家分享一篇關(guān)于Vue核心概念A(yù)ction的總結(jié),小編覺得內(nèi)容挺不錯(cuò)的,現(xiàn)在分享給大家,具有很好的參考價(jià)值,需要的朋友一起跟隨小編來看看吧
    2019-01-01
  • vue3?hook自動(dòng)導(dǎo)入原理及使用

    vue3?hook自動(dòng)導(dǎo)入原理及使用

    最近學(xué)習(xí)了hooks,特地寫一篇文章加深一下印象,下面這篇文章主要給大家介紹了關(guān)于vue3?hook自動(dòng)導(dǎo)入原理及使用的相關(guān)資料,文中通過實(shí)例代碼介紹的非常詳細(xì),需要的朋友可以參考下
    2022-10-10
  • vue element-ui實(shí)現(xiàn)input輸入框金額數(shù)字添加千分位

    vue element-ui實(shí)現(xiàn)input輸入框金額數(shù)字添加千分位

    這篇文章主要介紹了vue element-ui實(shí)現(xiàn)input輸入框金額數(shù)字添加千分位,本文給大家介紹的非常詳細(xì),具有一定的參考借鑒價(jià)值,需要的朋友可以參考下
    2019-12-12
  • 簡單聊一聊Vue3組件更新過程

    簡單聊一聊Vue3組件更新過程

    我們不光要學(xué)會(huì)Vue的組件化實(shí)現(xiàn)過程,還要懂得組件數(shù)據(jù)發(fā)生變化,更新組件的過程,這篇文章主要給大家介紹了關(guān)于Vue3組件更新過程的相關(guān)資料,需要的朋友可以參考下
    2022-04-04
  • vue2實(shí)現(xiàn)手勢密碼功能

    vue2實(shí)現(xiàn)手勢密碼功能

    這篇文章主要為大家詳細(xì)介紹了vue2實(shí)現(xiàn)手勢密碼功能,文中示例代碼介紹的非常詳細(xì),具有一定的參考價(jià)值,感興趣的小伙伴們可以參考一下
    2022-03-03
  • 淺談vue項(xiàng)目如何打包扔向服務(wù)器

    淺談vue項(xiàng)目如何打包扔向服務(wù)器

    本篇文章主要介紹了淺談vue項(xiàng)目如何打包扔向服務(wù)器,小編覺得挺不錯(cuò)的,現(xiàn)在分享給大家,也給大家做個(gè)參考。一起跟隨小編過來看看吧
    2018-05-05
  • 解決Vue+Electron下Vuex的Dispatch沒有效果問題

    解決Vue+Electron下Vuex的Dispatch沒有效果問題

    這篇文章主要介紹了Vue+Electron下Vuex的Dispatch沒有效果的解決方案 ,本文給大家介紹的非常詳細(xì),具有一定的參考借鑒價(jià)值,需要的朋友可以參考下
    2019-05-05
  • Vue3中配置404路由及懶加載的解決過程

    Vue3中配置404路由及懶加載的解決過程

    這篇文章主要介紹了Vue3中配置404路由及懶加載的解決過程,具有很好的參考價(jià)值,希望對大家有所幫助,如有錯(cuò)誤或未考慮完全的地方,望不吝賜教
    2025-04-04

最新評論

临江市| 阳谷县| 琼中| 芒康县| 响水县| 公主岭市| 乐东| 岳池县| 马尔康县| 蒙阴县| 石嘴山市| 南阳市| 桐城市| 南溪县| 安国市| 平塘县| 泉州市| 荆门市| 呼图壁县| 井研县| 闵行区| 始兴县| 连城县| 扎鲁特旗| 原阳县| 垫江县| 彭泽县| 屏边| 永和县| 防城港市| 肃南| 全州县| 温宿县| 云浮市| 平遥县| 随州市| 精河县| 宕昌县| 仪陇县| 辛集市| 花垣县|