Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in / Register
Toggle navigation
M
my-map
Project
Project
Details
Activity
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
郭铭瑶
my-map
Commits
66f7f325
Commit
66f7f325
authored
Aug 10, 2021
by
郭铭瑶
🤘
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
使用namespace
parent
5c0ff280
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
32 additions
and
28 deletions
+32
-28
main.vue
src/components/main.vue
+17
-17
index.ts
src/my-map/index.ts
+15
-11
No files found.
src/components/main.vue
View file @
66f7f325
...
...
@@ -15,9 +15,9 @@
<
script
lang=
"ts"
setup
>
import
icon1
from
'@/assets/images/icon1.png'
import
MyMap
from
'@/my-map/my-map'
import
useMap
from
'@/my-map'
import
{
MyMap
}
from
'@/my-map'
import
{
nextTick
,
onMounted
}
from
'vue'
let
map
:
MyMap
let
pointsLayer
:
any
let
linesLayer
:
any
...
...
@@ -26,24 +26,24 @@ let polygonLayer: any
onMounted
(
async
()
=>
{
await
nextTick
()
map
=
useMap
(
'SMap'
).
with
({
el
:
'container'
,
center
:
[
0
,
0
],
zoom
:
5
,
style
:
'smap://styles/dark'
,
appKey
:
'ACF69EDK17LON63GHPF081'
,
netType
:
'internet'
,
})
// map = useMap('AIMap').with({
// map = MyMap.useMap('SMap').with({
// el: 'container',
// center: [
121.612846, 31.205494
],
// zoom:
13
,
// style: '
aimap://styles/aimap/darkblue-v4
',
// appKey: '
gt8XidVe5upHf7cirkJwwXTCWj20zfu3
',
//
baseApiUrl: 'https://location-dev.newayz.com
',
// center: [
0, 0
],
// zoom:
5
,
// style: '
smap://styles/dark
',
// appKey: '
ACF69EDK17LON63GHPF081
',
//
netType: 'internet
',
// })
map
=
MyMap
.
useMap
(
'AIMap'
).
with
({
el
:
'container'
,
center
:
[
121.612846
,
31.205494
],
zoom
:
13
,
style
:
'aimap://styles/aimap/darkblue-v4'
,
appKey
:
'gt8XidVe5upHf7cirkJwwXTCWj20zfu3'
,
baseApiUrl
:
'https://location-dev.newayz.com'
,
})
map
.
on
(
'load'
,
addControls
)
.
on
(
'click'
,
(
a
,
b
)
=>
console
.
log
(
a
,
b
))
...
...
src/my-map/index.ts
View file @
66f7f325
import
{
AIMapConfig
,
MapConfig
,
SMapConfig
}
from
'./types'
import
type
MapType
from
'./my-map'
import
S_Map
from
'./s-map'
import
AI_Map
from
'./ai-map'
...
...
@@ -19,17 +20,20 @@ const whichMap = {
},
}
/**
* 创建地图
* @param key 地图关键字:
*
* 'SMap': 测绘院地图
*
* 'AIMap': 维智地图
*
*/
export
default
function
useMap
<
K
extends
keyof
typeof
whichMap
>
(
key
:
K
)
{
return
whichMap
[
key
]
export
type
MyMap
=
MapType
export
namespace
MyMap
{
/**
* 创建地图
* @param key 地图关键字:
*
* 'SMap': 测绘院地图
*
* 'AIMap': 维智地图
*
*/
export
function
useMap
<
K
extends
keyof
typeof
whichMap
>
(
key
:
K
)
{
return
whichMap
[
key
]
}
}
// function _injectSource(sources: any[]): Promise<unknown[]> {
...
...
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