tencent-map
v1.0.2
Published
腾讯地图 支持vue版 可用于手机端和pc端
Downloads
16
Readme
腾讯地图
- Support the VUE
- It can be used on mobile phone or PC
Usage
- npm i tencent-map -S
- import TencentMap from "tencent-map";
- TencentMap.load(elements: any, config: { mapKey: String, mapVer: String, mapApi: String }): Promise
Example
VUE
import TencentMap from "tencent-map";
<template>
<div ref="tencentMap" style="height:600px"></div>
</template>
<script>
export default {
created() {
this.$nextTick(() => {
TencentMap.load(this.$refs.tencentMap, { mapKey: "key..." }).then(qq => {
const myLatlng = new qq.maps.LatLng(-34.397, 150.644);
const myOptions = {
zoom: 8,
center: myLatlng,
mapTypeId: qq.maps.MapTypeId.ROADMAP
};
new qq.maps.Map(TencentMap.elements, myOptions);
});
});
}
}
</script>