-
-
Notifications
You must be signed in to change notification settings - Fork 41
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
15 changed files
with
127 additions
and
89 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -15,5 +15,5 @@ declare module '*.vue' { | |
export default component | ||
} | ||
// 百度地图 | ||
declare const BMap: any | ||
// declare const BMap: any | ||
|
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
import { getCurrentInstance } from 'vue' | ||
import { BMapGL } from 'types/index.d' | ||
// import useEmitter from './useEmitter' | ||
export function useBaseMapInitdCallback(cal: (mapInstance: BMapGL['Map']) => void) { | ||
const parent: any = getCurrentInstance()?.parent | ||
const { map, emitter } = parent.exposed | ||
map() ? cal(map()) : emitter.on('onInitd', () => cal(map())) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
import mitt from 'mitt' | ||
const emitter = mitt() | ||
export function useEmits(vueEmits?: any) { | ||
return { | ||
emit: (event: string, arg?: any) => { | ||
emitter.emit(event, arg) | ||
vueEmits && vueEmits(event, arg) | ||
}, | ||
on: (event: string, cal: (arg: any) => void) => { | ||
emitter.on(event, cal) | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,5 @@ | ||
<template> | ||
<div>我是子组件</div> | ||
<slot></slot> | ||
</template> | ||
|
||
<script setup lang="ts"> | ||
import { useBaseMap } from 'hooks/useBaseMap' | ||
const { map } = useBaseMap() | ||
console.log(map) | ||
</script> | ||
<script setup lang="ts"></script> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
<template></template> | ||
|
||
<script setup lang="ts"> | ||
// import { useBaseMapInitdCallback } from 'hooks/useBaseMapInitdCallback' | ||
import { useEmits } from 'hooks/useEmits' | ||
const { on } = useEmits() | ||
on('onInitd', (map) => { | ||
const scaleCtrl = new window.BMapGL.ScaleControl() | ||
map.addControl(scaleCtrl) | ||
}) | ||
</script> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -23,6 +23,7 @@ | |
"src/**/*.d.ts", | ||
"src/**/*.tsx", | ||
"src/**/*.vue", | ||
"src/**/**/*.vue", | ||
"types/*.ts" | ||
], | ||
"references": [ | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters