Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenDocCN
vue-gis
提交
0e26813b
V
vue-gis
项目概览
OpenDocCN
/
vue-gis
通知
3
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
V
vue-gis
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
前往新版Gitcode,体验更适合开发者的 AI 搜索 >>
提交
0e26813b
编写于
12月 16, 2019
作者:
T
tgd
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
marker
上级
87746ed8
变更
11
隐藏空白更改
内联
并排
Showing
11 changed file
with
193 addition
and
45 deletion
+193
-45
README.md
README.md
+2
-2
src/assets/gis/monitor-active.png
src/assets/gis/monitor-active.png
+0
-0
src/assets/gis/monitor.png
src/assets/gis/monitor.png
+0
-0
src/router/routes.js
src/router/routes.js
+28
-28
src/views/home/index.vue
src/views/home/index.vue
+3
-3
src/views/marker/index.vue
src/views/marker/index.vue
+1
-1
src/views/marker/markers/index.vue
src/views/marker/markers/index.vue
+81
-0
src/views/marker/one/index.vue
src/views/marker/one/index.vue
+77
-0
src/views/marker/popup/index.vue
src/views/marker/popup/index.vue
+1
-1
src/views/test/test1/index.vue
src/views/test/test1/index.vue
+0
-5
src/views/test/test2/index.vue
src/views/test/test2/index.vue
+0
-5
未找到文件。
README.md
浏览文件 @
0e26813b
...
...
@@ -21,8 +21,8 @@
本项目实现demo内容有:
> - [
] 使用起步
> - [
] 打点(一个点、多个点、带popup的点)
> - [
x
] 使用起步
> - [
x
] 打点(一个点、多个点、带popup的点)
> - [x] 使用
## 使用起步
...
...
src/assets/gis/monitor-active.png
0 → 100644
浏览文件 @
0e26813b
1.7 KB
src/assets/gis/monitor.png
0 → 100644
浏览文件 @
0e26813b
1.2 KB
src/router/routes.js
浏览文件 @
0e26813b
...
...
@@ -6,6 +6,34 @@ const routes = [
icon
:
'
el-icon-s-home
'
,
component
:
()
=>
import
(
'
@/views/home
'
)
},
{
path
:
'
/marker
'
,
redirect
:
'
/marker/one
'
,
name
:
'
marker
'
,
text
:
'
打点
'
,
icon
:
'
el-icon-s-help
'
,
component
:
()
=>
import
(
'
@/views/marker
'
),
children
:
[
{
path
:
'
/marker/one
'
,
name
:
'
oneMarker
'
,
text
:
'
打一个点
'
,
component
:
()
=>
import
(
'
@/views/marker/one
'
)
},
{
path
:
'
/marker/markers
'
,
name
:
'
markers
'
,
text
:
'
打多个点
'
,
component
:
()
=>
import
(
'
@/views/marker/markers
'
)
},
{
path
:
'
/marker/popup
'
,
name
:
'
popup
'
,
text
:
'
打点带popup
'
,
component
:
()
=>
import
(
'
@/views/marker/popup
'
)
}
]
},
{
path
:
'
/base
'
,
redirect
:
'
/base/start
'
,
...
...
@@ -21,34 +49,6 @@ const routes = [
component
:
()
=>
import
(
'
@/views/base/start
'
)
}
]
},
{
path
:
'
/test
'
,
redirect
:
'
/test/test1
'
,
name
:
'
test
'
,
text
:
'
测试
'
,
icon
:
'
el-icon-s-help
'
,
component
:
()
=>
import
(
'
@/views/test
'
),
children
:
[
{
path
:
'
/test/test1
'
,
name
:
'
test1
'
,
text
:
'
测试1
'
,
component
:
()
=>
import
(
'
@/views/test/test1
'
)
},
{
path
:
'
/test/test2
'
,
name
:
'
test2
'
,
text
:
'
测试2
'
,
component
:
()
=>
import
(
'
@/views/test/test2
'
)
},
{
path
:
'
/test/hh
'
,
name
:
'
hh
'
,
text
:
'
hh
'
,
component
:
()
=>
import
(
'
@/views/test/hh
'
)
}
]
}
]
...
...
src/views/home/index.vue
浏览文件 @
0e26813b
...
...
@@ -53,9 +53,9 @@ export default {
maxZoom
:
18
,
// 最大缩放
minZoom
:
1
,
// 最小缩放
layers
:
[
normal
],
// 地图图层
zoomControl
:
false
,
// 是否显示放大缩小按钮
attributionControl
:
false
,
// 是否关闭leaflet广告链接(在地图的右下角)
closePopupOnClick
:
true
,
// 点击地图是否关闭popup
zoomControl
:
false
,
// 是否显示放大缩小按钮
attributionControl
:
false
,
// 是否关闭leaflet广告链接(在地图的右下角)
closePopupOnClick
:
true
// 点击地图是否关闭popup
})
// 地图模式切换
L
.
control
.
layers
(
baseLayers
,
null
).
addTo
(
map
)
...
...
src/views/
test
/index.vue
→
src/views/
marker
/index.vue
浏览文件 @
0e26813b
<
template
>
<div>
<div
style=
"width: 100%; height: 100%;"
>
<router-view></router-view>
</div>
</
template
>
src/views/marker/markers/index.vue
0 → 100644
浏览文件 @
0e26813b
<
template
>
<div
class=
"map"
id=
"map"
></div>
</
template
>
<
script
>
import
L
from
'
leaflet
'
import
'
leaflet.chinatmsproviders
'
import
'
leaflet/dist/leaflet.css
'
// 常量
// 定位中心点
const
center
=
[
30.659791980587134
,
104.0633797645569
]
export
default
{
mounted
()
{
this
.
init
()
},
methods
:
{
init
()
{
const
map
=
L
.
map
(
'
map
'
,
{
center
:
center
,
zoom
:
13
,
maxZoom
:
18
,
minZoom
:
1
,
zoomControl
:
false
,
attributionControl
:
false
,
closePopupOnClick
:
true
})
L
.
tileLayer
.
chinaProvider
(
'
GaoDe.Normal.Map
'
,
{
maxZoom
:
18
,
minZoom
:
1
,
ak
:
'
您申请的key值
'
})
.
addTo
(
map
)
// marker icon自定义
const
Icon
=
L
.
Icon
.
extend
({
options
:
{
iconUrl
:
require
(
'
@/assets/gis/monitor.png
'
),
iconSize
:
[
36
,
39
],
iconAnchor
:
[
18
,
-
5
]
}
})
const
icon
=
new
Icon
()
// 造100个点
const
arr
=
new
Array
(
100
)
const
markers
=
[]
arr
.
fill
(
1
).
forEach
((
item
,
i
)
=>
{
let
marker
=
new
L
.
Marker
(
i
%
2
===
0
?
[
center
[
0
]
+
i
*
0.01
*
Math
.
random
(),
center
[
1
]
+
i
*
0.01
*
Math
.
random
()]
:
[
center
[
0
]
-
i
*
0.01
*
Math
.
random
(),
center
[
1
]
-
i
*
0.01
*
Math
.
random
()],
{
icon
:
icon
}
)
const
content
=
`
<b>Hello world!</b><br/>
我是成都<br/>
编号:
${
i
+
1
}
`
marker
.
bindPopup
(
content
)
marker
.
on
(
'
click
'
,
e
=>
{
console
.
log
(
'
marker被点击了
'
)
})
markers
.
push
(
marker
)
})
// 批量打点
L
.
layerGroup
(
markers
).
addTo
(
map
)
}
}
}
</
script
>
<
style
scoped
>
.map
{
width
:
100%
;
height
:
100%
;
}
</
style
>
src/views/marker/one/index.vue
0 → 100644
浏览文件 @
0e26813b
<
template
>
<div
class=
"map"
id=
"map"
></div>
</
template
>
<
script
>
import
L
from
'
leaflet
'
import
'
leaflet.chinatmsproviders
'
import
'
leaflet/dist/leaflet.css
'
// 常量
// 定位中心点
const
center
=
[
30.659791980587134
,
104.0633797645569
]
export
default
{
mounted
()
{
this
.
init
()
},
methods
:
{
init
()
{
const
map
=
L
.
map
(
'
map
'
,
{
center
:
center
,
zoom
:
13
,
maxZoom
:
18
,
minZoom
:
1
,
zoomControl
:
false
,
attributionControl
:
false
,
closePopupOnClick
:
true
})
// 采用addTo添加地图图层,一般addTo用的比较多
L
.
tileLayer
.
chinaProvider
(
'
GaoDe.Normal.Map
'
,
{
maxZoom
:
18
,
minZoom
:
1
,
ak
:
'
您申请的key值
'
})
.
addTo
(
map
)
// 或采用addLayer添加地图图层
// const tileLayer = L.tileLayer.chinaProvider('GaoDe.Normal.Map', {
// maxZoom: 18,
// minZoom: 1,
// ak: '您申请的key值'
// })
// map.addLayer(tileLayer)
// marker icon自定义
const
Icon
=
L
.
Icon
.
extend
({
options
:
{
iconUrl
:
require
(
'
@/assets/gis/monitor.png
'
),
iconSize
:
[
36
,
39
],
iconAnchor
:
[
18
,
-
5
]
}
})
const
content
=
`
<b>Hello world!</b><br/>
我是成都<br/>
时间戳:
${
+
new
Date
()}
`
L
.
marker
(
center
,
{
icon
:
new
Icon
()
})
.
addTo
(
map
)
.
bindPopup
(
content
)
.
openPopup
()
}
}
}
</
script
>
<
style
scoped
>
.map
{
width
:
100%
;
height
:
100%
;
}
</
style
>
src/views/
test/hh
/index.vue
→
src/views/
marker/popup
/index.vue
浏览文件 @
0e26813b
<
template
>
<div>
hhhhhhhhhh
起步
</div>
</
template
>
src/views/test/test1/index.vue
已删除
100644 → 0
浏览文件 @
87746ed8
<
template
>
<div
class=
"about"
>
1
</div>
</
template
>
src/views/test/test2/index.vue
已删除
100644 → 0
浏览文件 @
87746ed8
<
template
>
<div
class=
"about"
>
2
</div>
</
template
>
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录