zoukankan      html  css  js  c++  java
  • vue 使用百度地图GL


    <script type="text/javascript" src="//api.map.baidu.com/api?type=webgl&v=1.0&ak=CWmiAPiwuHW6sGdMbAReZdqU"></script>



    <template>
    <div class="drawer">

    <div id="allmap" style="100%; height:500px;"></div>
    </div>
    </template>

    <script>
    export default {
    name: 'HelloWorld',
    props: {},
    data () {
    return {
    open: false,
    isActive: false,
    isClose: false
    }
    },
    mounted () {
    // GL版命名空间为BMapGL
    // 按住鼠标右键,修改倾斜角和角度
    var map = new BMapGL.Map('allmap') // 创建Map实例
    map.centerAndZoom(new BMapGL.Point(116.280190, 40.049191), 19) // 初始化地图,设置中心点坐标和地图级别
    map.enableScrollWheelZoom(true) // 开启鼠标滚轮缩放
    map.setHeading(64.5)
    map.setTilt(73)

    var marker = new BMapGL.Marker(new BMapGL.Point(116.280190, 40.049191)) // 创建点
    map.addOverlay(marker)
    },
    methods: {
    }
    }
    </script>




     在eslintrc.js中进行全局声明

    globals: {
    BMap: true
    }

  • 相关阅读:
    Palindrome
    Girls' research
    最长回文
    Water Tree
    Alternating Current
    Psychos in a Line
    Feel Good
    Color the Fence
    javaScript内置类Date,Math等
    DOM之兄弟节点
  • 原文地址:https://www.cnblogs.com/scode2/p/12103271.html
Copyright © 2011-2022 走看看