Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
hzz490277727
VueJS
提交
48868340
V
VueJS
项目概览
hzz490277727
/
VueJS
与 Fork 源项目一致
Fork自
inscode / VueJS
通知
1
Star
3
Fork
2
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
V
VueJS
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
提交
48868340
编写于
7月 13, 2023
作者:
6
64af954aa92c2a4195233d17
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Auto Commit
上级
f48a4a07
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
39 addition
and
8 deletion
+39
-8
index.html
index.html
+1
-0
src/components/amap.vue
src/components/amap.vue
+38
-8
未找到文件。
index.html
浏览文件 @
48868340
...
@@ -8,6 +8,7 @@
...
@@ -8,6 +8,7 @@
</head>
</head>
<body>
<body>
<div
id=
"app"
></div>
<div
id=
"app"
></div>
<script
type=
"text/javascript"
src=
'https://a.amap.com/jsapi_demos/static/citys.js'
></script>
<script
type=
"module"
src=
"/src/main.js"
></script>
<script
type=
"module"
src=
"/src/main.js"
></script>
</body>
</body>
</html>
</html>
src/components/amap.vue
浏览文件 @
48868340
...
@@ -18,16 +18,46 @@ function initMap() {
...
@@ -18,16 +18,46 @@ function initMap() {
zoom
:
4
,
//初始化地图级别
zoom
:
4
,
//初始化地图级别
center
:
[
104.06
,
35.67
],
//初始化地图中心点位置
center
:
[
104.06
,
35.67
],
//初始化地图中心点位置
});
});
generatePoints
().
forEach
((
item
)
=>
{
//
generatePoints().forEach((item) => {
const
marker
=
new
AMap
.
Marker
({
//
const marker = new AMap.Marker({
position
:
new
AMap
.
LngLat
(
item
.
position
[
0
],
item
.
position
[
1
]),
// 经纬度对象,也可以是经纬度构成的一维数组[116.39, 39.9]
//
position: new AMap.LngLat(item.position[0], item.position[1]), // 经纬度对象,也可以是经纬度构成的一维数组[116.39, 39.9]
title
:
'
北京
'
//
title: '北京'
});
//
});
// 将创建的点标记添加到已有的地图实例:
// // 将创建的点标记添加到已有的地图实例:
map
.
add
(
marker
);
// map.add(marker);
})
// })
var
style
=
[{
url
:
'
https://a.amap.com/jsapi_demos/static/images/mass0.png
'
,
anchor
:
new
AMap
.
Pixel
(
6
,
6
),
size
:
new
AMap
.
Size
(
11
,
11
)
},
{
url
:
'
https://a.amap.com/jsapi_demos/static/images/mass1.png
'
,
anchor
:
new
AMap
.
Pixel
(
4
,
4
),
size
:
new
AMap
.
Size
(
7
,
7
)
},
{
url
:
'
https://a.amap.com/jsapi_demos/static/images/mass2.png
'
,
anchor
:
new
AMap
.
Pixel
(
3
,
3
),
size
:
new
AMap
.
Size
(
5
,
5
)
}
];
var
mass
=
new
AMap
.
MassMarks
(
citys
,
{
opacity
:
0.8
,
zIndex
:
111
,
cursor
:
'
pointer
'
,
style
:
style
});
var
marker
=
new
AMap
.
Marker
({
content
:
'
'
,
map
:
map
});
mass
.
on
(
'
mouseover
'
,
function
(
e
)
{
marker
.
setPosition
(
e
.
data
.
lnglat
);
marker
.
setLabel
({
content
:
e
.
data
.
name
})
});
mass
.
setMap
(
map
);
}).
catch
(
e
=>
{
}).
catch
(
e
=>
{
console
.
log
(
e
);
console
.
log
(
e
);
})
})
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录