Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
B
baidu_map
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
mahui
baidu_map
Commits
902d6337
Commit
902d6337
authored
Jun 17, 2021
by
mahui
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
asdasfdasf
parent
4ebf905c
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
13 additions
and
3 deletions
+13
-3
map.vue
src/components/map.vue
+13
-3
No files found.
src/components/map.vue
View file @
902d6337
...
@@ -1294,8 +1294,8 @@
...
@@ -1294,8 +1294,8 @@
clearOverlays
()
{
clearOverlays
()
{
// 百度地图API功能
// 百度地图API功能
this
.
map
=
new
BMap
.
Map
(
"allMap"
);
this
.
map
=
new
BMap
.
Map
(
"allMap"
);
let
coordinate
=
new
BMap
.
Point
(
119.
352500
,
30.234
125
);
// 创建标注
let
coordinate
=
new
BMap
.
Point
(
119.
798500
,
30.300
125
);
// 创建标注
this
.
map
.
centerAndZoom
(
coordinate
,
1
1
);
this
.
map
.
centerAndZoom
(
coordinate
,
1
3
);
this
.
map
.
addControl
(
new
BMap
.
NavigationControl
());
// 添加平移缩放控件
this
.
map
.
addControl
(
new
BMap
.
NavigationControl
());
// 添加平移缩放控件
this
.
map
.
addControl
(
new
BMap
.
ScaleControl
());
// 添加比例尺控件
this
.
map
.
addControl
(
new
BMap
.
ScaleControl
());
// 添加比例尺控件
this
.
map
.
addControl
(
new
BMap
.
OverviewMapControl
());
//添加缩略地图控件
this
.
map
.
addControl
(
new
BMap
.
OverviewMapControl
());
//添加缩略地图控件
...
@@ -1327,7 +1327,17 @@
...
@@ -1327,7 +1327,17 @@
fontFamily
:
"微软雅黑"
fontFamily
:
"微软雅黑"
});
});
this
.
map
.
addOverlay
(
label
);
this
.
map
.
addOverlay
(
label
);
let
myIcon
=
new
BMap
.
Icon
(
url
,
new
BMap
.
Size
(
40
,
81
));
let
myIcon
=
new
BMap
.
Icon
(
url
,
new
BMap
.
Size
(
40
,
81
),{
// 指定定位位置。
// 当标注显示在地图上时,其所指向的地理位置距离图标左上
// 角各偏移10像素和25像素。您可以看到在本例中该位置即是
// 图标中央下端的尖角位置。
anchor
:
new
BMap
.
Size
(
20
,
81
),
// 设置图片偏移。
// 当您需要从一幅较大的图片中截取某部分作为标注图标时,您
// 需要指定大图的偏移位置,此做法与css sprites技术类似。
// imageOffset: new BMap.Size(0, 0 - 81) // 设置图片偏移
});
let
marker
=
new
BMap
.
Marker
(
coordinate
,
{
icon
:
myIcon
});
let
marker
=
new
BMap
.
Marker
(
coordinate
,
{
icon
:
myIcon
});
this
.
map
.
addOverlay
(
marker
);
// 将标注添加到地图中
this
.
map
.
addOverlay
(
marker
);
// 将标注添加到地图中
marker
.
addEventListener
(
"click"
,
function
()
{
marker
.
addEventListener
(
"click"
,
function
()
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment