Skip to content

Commit

Permalink
feat: 导出 ts 类型:
Browse files Browse the repository at this point in the history
1. ContextMenuItem和ContextMenuSeparator
2. DisplayOptions
  • Loading branch information
yue1123 committed Dec 2, 2022
1 parent 44d3fe3 commit 574cb8e
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 6 deletions.
12 changes: 6 additions & 6 deletions packages/components/overlay/polygon/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
import bindEvents, { Callback } from '../../../utils/bindEvents'
import useLifeCycle from '../../../hooks/useLifeCycle'
import { callWhenDifferentValue } from '../../../utils'
export interface PolygonPath {
export interface PolygonPathPoint {
/**
* 地理经度
*/
Expand All @@ -20,7 +20,7 @@
/**
* 折线的节点坐标数组
*/
path: NonEmptyArray<PolygonPath> | NonEmptyArray<string>
path: PolygonPathPoint[] | string[]
/**
* 是否是行政区域绘制
*/
Expand Down Expand Up @@ -142,7 +142,7 @@
clip,
isBoundary
} = props
const pathPoints = isBoundary ? (path as string[]) : pathPointsToMapPoints(path as PolygonPath[])
const pathPoints = isBoundary ? (path as string[]) : pathPointsToMapPoints(path as PolygonPathPoint[])
if (!pathPoints) return
polygon = new BMapGL.Polygon(pathPoints, {
strokeColor,
Expand Down Expand Up @@ -201,15 +201,15 @@
})
}
function pathPointsToMapPoints(pathPoints: PolygonPath[]) {
function pathPointsToMapPoints(pathPoints: PolygonPathPoint[]) {
return pathPoints.map(({ lng, lat }) => new BMapGL.Point(lng, lat))
}
function setPath(path: PolygonPath[] | string[]) {
function setPath(path: PolygonPathPoint[] | string[]) {
if (props.isBoundary) {
polygon.setPath(path as string[])
} else {
polygon.setPath(pathPointsToMapPoints(path as PolygonPath[]))
polygon.setPath(pathPointsToMapPoints(path as PolygonPathPoint[]))
}
syncMapCenter()
}
Expand Down
9 changes: 9 additions & 0 deletions packages/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ export * from './hooks/usePointConvertor'

// components
import Map from './components/map/index.vue'
export type { DisplayOptions } from './components/map/index.vue'

import Control from './components/control/control/index.vue'
import Scale from './components/control/scale/index.vue'
Expand All @@ -49,6 +50,8 @@ import Prism from './components/overlay/prism/index.vue'
import GroundOverlay from './components/overlay/ground-overlay/index.vue'

import ContextMenu from './components/contextMenu/index.vue'
export type ContextMenuSeparator = '-'
export type { ContextMenuItem } from './components/contextMenu/index.vue'
// import MapvglView from './components/layer/mapvgl-view/index.vue'

const componentsList = [
Expand Down Expand Up @@ -120,3 +123,9 @@ export {
GroundOverlay
}
export default vue3BaiduMapGl

/**
* FIXME:
* ts 类型错误
* 1. 导出 mapType
*/

0 comments on commit 574cb8e

Please sign in to comment.