Comments (11)
在vue-amap
的文档中,暂时并没有AMap.Geolocation
插件。
但并不代表不支持,只是觉得暂时不够友好,正在优化中。
如果现在需要使用,可以这样。
- 全局引用插件
AMap.initAMapApiLoader({
key: 'your code',
plugin: [..., 'Geolocation']
});
- 配置插件
data () {
return {
loading: false,
zoom: 16,
amapManager: amapManager,
plugins: [
{
pName: 'Geolocation',
events: {
init (instance) {
// 手动调用定位
instance.getCurrentPosition()
window.console.log(instance)
}
}
}
]
}
}
from vue-amap.
是否想得到类似下面这样的使用:
<el-amap address="上海真北路**号"></el-amap>
然后直接定位此地。
from vue-amap.
@AxeMea
不是,前面可能表达不清,其实就是地图定位,我需要借助浏览器定位来获取当前位置的地址信息(包括经纬度)。 效果像这样http://lbs.amap.com/api/javascript-api/example/location/browser-location/。
我尝试这样去引入定位控件,不过不行。
data () {
return {
loading: false,
zoom: 16,
amapManager: amapManager,
plugins: [
{
pName: 'AMap.Geolocation',
init (instance) {
window.console.log(instance)
}
}
]
}
}
from vue-amap.
@AxeMea 可以了,谢谢。我也应该多尝试的。Thanks
from vue-amap.
@AxeMea plugin的events除init其他的事件好像没注册成功。
plugins: [
{
pName: 'Geolocation',
enableHighAccuracy: true,
timeout: 10000,
zoomToAccuracy: true,
buttonPosition: 'RB',
events: {
init (instance) {
instance.getCurrentPosition()
window.console.log(AMap.event)
},
complete (data) {
window.console.log(data)
},
error () {
window.console.log('error')
}
}
},
{
pName: 'ToolBar',
events: {
init (instance) {
window.console.log(instance)
},
zoomchanged (type) {
window.console.log(type)
}
}
}
]
我本想是因为Geolocation是未来feature的原因,不过好像试了你们文档里面的ToolBar好像也不行。是不是src/lib/components/amap.vue里面166行有点问题?
165 for (let [k, v] of Object.entries(_plugin.events)) {
166 if (k === 'init') return;
167 AMap.event.addListener(this.$plugins[realPlugin.pName], k, v);
168 }
在判断是init的时候,应该是continue才对?
from vue-amap.
谢谢反馈。请更新至 0.1.5
问题已修复。
from vue-amap.
@AxeMea 0.1.5的还是不行,是不是最终编译的时候出了问题?还是用法改了?
我的代码还是
Vue.use(AMap)
然后0.1.5下报错
断点查看
对比0.1.4的断点
from vue-amap.
@SanhongWong 不好意思,更换了构建工具。已修复,更新到 v0.1.6
from vue-amap.
thanks
from vue-amap.
请问 amapManager
@AxeMea 如何引用
from vue-amap.
<template>
<el-amap vid="amap-vue" :map-manager="amapManager" >
</el-amap>
</template>
<script>
import {AmapManger} from 'vue-amap';
const amapManger = new AmapManger();
export default {
date() {
return {
amapMager: amapManger
};
}
};
</script>
from vue-amap.
Related Issues (20)
- 高德地图API 12月更新加入了密匙 HOT 2
- 使用密钥转发之后,getCurrentPosition()这个方法失效了
- 高德离线地图可以使用吗 HOT 1
- 怎么使用高德的自定义地图? HOT 1
- 地图搜索多了一个参数s=rsv3
- 示例怎么都没了,这对于初次使用的很不友好啊!!更新换带了个寂寞啊 HOT 1
- 文档示例中引用在线vue资源报404 如图
- 高德地图加载不出来,有高德的logo,但地图一片空白 HOT 2
- 使用高德版本 v:2.0 之后 绑定evenet 报请等待地图加载完毕之后再进行绑定事件错误
- 使用高德版本 v:2.0 之后 绑定evenet 报请等待地图加载完毕之后再进行绑定事件错误 HOT 5
- USER_DAILY_QUERY_OVER_LIMIT
- English version on AMap v2.0
- 自定义地图样式不显示
- 使用avue-map搜索时报错INVALID_USER_SCODE
- 关于searchBox的疑问 HOT 1
- 更换标记点报错
- 关于高德平台自2021年12月02日升级,升级之后所申请的 key 必须配备安全密钥 jscode 一起使用
- 还有人维护吗
- 通过spacedesk投屏后,无法手势缩放!!!!
- 鼠标滚轮缩放比例太小了,滚了半天才到底如何配置大一点
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from vue-amap.