From 533b8d0a480b8ed93156dce276d1cc6bbc7d62a6 Mon Sep 17 00:00:00 2001 From: Edward <809537981@qq.com> Date: Sun, 4 Oct 2020 02:12:40 +0800 Subject: [PATCH] =?UTF-8?q?=E8=A7=A3=E5=86=B3=20=E7=BB=84=E4=BB=B6?= =?UTF-8?q?=E7=B1=BB=E5=9E=8B=E5=A3=B0=E6=98=8E=E9=94=99=E8=AF=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- index.d.ts | 3 --- package.json | 1 + types/auto-complete.d.ts | 3 ++- types/base/base-control.d.ts | 4 +++- types/base/component.d.ts | 5 +++++ types/boundary.d.ts | 3 ++- types/bus.d.ts | 3 ++- types/circle.d.ts | 3 ++- types/copyright.d.ts | 4 ++-- types/curve-line.d.ts | 3 ++- types/driving.d.ts | 3 ++- types/ground.d.ts | 3 ++- types/info-window.d.ts | 3 ++- types/item.d.ts | 3 ++- types/label.d.ts | 3 ++- types/local-search.d.ts | 3 ++- types/lushu.d.ts | 3 ++- types/map-type.d.ts | 4 ++-- types/map-view.d.ts | 3 ++- types/map.d.ts | 3 ++- types/marker-clusterer.d.ts | 3 ++- types/marker.d.ts | 3 ++- types/menu.d.ts | 3 ++- types/overlay.d.ts | 3 ++- types/point-collection.d.ts | 3 ++- types/polygon.d.ts | 3 ++- types/polyline.d.ts | 3 ++- types/tile.d.ts | 3 ++- types/traffic.d.ts | 3 ++- types/transit.d.ts | 3 ++- types/walking.d.ts | 3 ++- 31 files changed, 63 insertions(+), 33 deletions(-) delete mode 100644 index.d.ts create mode 100644 types/base/component.d.ts diff --git a/index.d.ts b/index.d.ts deleted file mode 100644 index 5091cecc..00000000 --- a/index.d.ts +++ /dev/null @@ -1,3 +0,0 @@ -/// - -declare module 'vue-baidu-map' \ No newline at end of file diff --git a/package.json b/package.json index e7182bd4..51e1b580 100644 --- a/package.json +++ b/package.json @@ -15,6 +15,7 @@ "lint": "eslint --ext .js,.vue src docs build", "prepublishOnly": "npm run build" }, + "types": "types/index.d.ts", "repository": { "type": "git", "url": "git+https://github.com/Dafrok/vue-baidu-map.git" diff --git a/types/auto-complete.d.ts b/types/auto-complete.d.ts index 18101232..0f5a875e 100644 --- a/types/auto-complete.d.ts +++ b/types/auto-complete.d.ts @@ -1,8 +1,9 @@ import { Point } from "./base/common"; import { Map } from "./map"; +import { BaiduMapComponent } from './base/component' -export declare class AutoComplete { +export declare class AutoComplete extends BaiduMapComponent { /** * 返回数据类型。两种设置方式,第一种为默认值(即设置值为空),将返回所有数据。 * 如地图初始化为北京,在输入框中输入“小”,输入框下会出现包含“小”关键字的多种类型(如餐饮、地名等)的提示词条。 diff --git a/types/base/base-control.d.ts b/types/base/base-control.d.ts index 21fc735e..2f7281b9 100644 --- a/types/base/base-control.d.ts +++ b/types/base/base-control.d.ts @@ -1,6 +1,8 @@ import { ControlAnchor, Size } from './common' +import { BaiduMapComponent } from './component' -export declare class BaseControl { + +export declare class BaseControl extends BaiduMapComponent { /** * 控件的停靠位置,默认定位到地图的右下角 */ diff --git a/types/base/component.d.ts b/types/base/component.d.ts new file mode 100644 index 00000000..6154f7db --- /dev/null +++ b/types/base/component.d.ts @@ -0,0 +1,5 @@ +import Vue from 'vue' + +/** BaiduMap component common definition */ +export declare class BaiduMapComponent extends Vue { +} diff --git a/types/boundary.d.ts b/types/boundary.d.ts index 54ee641c..cb05077e 100644 --- a/types/boundary.d.ts +++ b/types/boundary.d.ts @@ -1,5 +1,6 @@ +import { BaiduMapComponent } from './base/component' -export declare class Boundary { +export declare class Boundary extends BaiduMapComponent { /** * 行政区划名称 */ diff --git a/types/bus.d.ts b/types/bus.d.ts index c903845f..4b6ca858 100644 --- a/types/bus.d.ts +++ b/types/bus.d.ts @@ -1,6 +1,7 @@ +import { BaiduMapComponent } from './base/component' import { Point } from './base/common' -export declare class Bus { +export declare class Bus extends BaiduMapComponent { /** * location表示检索区域,其类型可为空、坐标点或城市名称的字符串。当参数为空时, * 检索位置由当前地图中心点确定,且搜索结果的标注将自动加载到地图上,并支持调整地图视野层级; diff --git a/types/circle.d.ts b/types/circle.d.ts index 1c2f4a25..66204526 100644 --- a/types/circle.d.ts +++ b/types/circle.d.ts @@ -1,6 +1,7 @@ +import { BaiduMapComponent } from './base/component' import { Point } from './base/common' -export declare class Circle { +export declare class Circle extends BaiduMapComponent { center: Point /** * 设置圆形的半径,单位为米 diff --git a/types/copyright.d.ts b/types/copyright.d.ts index 55ac1f1d..bdb88a73 100644 --- a/types/copyright.d.ts +++ b/types/copyright.d.ts @@ -1,7 +1,7 @@ -import { Point, Copyright } from './base/common' +import { Copyright as c } from './base/common' import { BaseControl } from './base/base-control' export declare class Copyright extends BaseControl { - copyright: Copyright[] + copyright: c[] } \ No newline at end of file diff --git a/types/curve-line.d.ts b/types/curve-line.d.ts index bf23b4dc..69f67484 100644 --- a/types/curve-line.d.ts +++ b/types/curve-line.d.ts @@ -1,6 +1,7 @@ +import { BaiduMapComponent } from './base/component' import { Point } from './base/common' -export declare class CurveLine { +export declare class CurveLine extends BaiduMapComponent { /** * 构成弧线的关键点 */ diff --git a/types/driving.d.ts b/types/driving.d.ts index 36cdcece..ce028b98 100644 --- a/types/driving.d.ts +++ b/types/driving.d.ts @@ -1,6 +1,7 @@ +import { BaiduMapComponent } from './base/component' import { Point, LocalResultPoi, DrivingPolicy } from './base/common' -export declare class Driving { +export declare class Driving extends BaiduMapComponent { /** * location表示检索区域,其类型可为空、坐标点或城市名称的字符串。当参数为空时, * 检索位置由当前地图中心点确定,且搜索结果的标注将自动加载到地图上,并支持调整地图视野层级; diff --git a/types/ground.d.ts b/types/ground.d.ts index def20ffa..f5f049f4 100644 --- a/types/ground.d.ts +++ b/types/ground.d.ts @@ -1,6 +1,7 @@ +import { BaiduMapComponent } from './base/component' import { Bounds } from './base/common' -export declare class Ground { +export declare class Ground extends BaiduMapComponent { /** * 设置图层显示的矩形区域 */ diff --git a/types/info-window.d.ts b/types/info-window.d.ts index f3d12638..dbe1a13d 100644 --- a/types/info-window.d.ts +++ b/types/info-window.d.ts @@ -1,6 +1,7 @@ +import { BaiduMapComponent } from './base/component' import { Point, Size } from './base/common' -export declare class InfoWindow { +export declare class InfoWindow extends BaiduMapComponent { /** * @default false */ diff --git a/types/item.d.ts b/types/item.d.ts index 0ea426f4..33cec96f 100644 --- a/types/item.d.ts +++ b/types/item.d.ts @@ -1,5 +1,6 @@ +import { BaiduMapComponent } from './base/component' -export declare class Item { +export declare class Item extends BaiduMapComponent { /** * 点击菜单时执行的回调函数,第一个参数为 {BMap, map, target, pixel, point} */ diff --git a/types/label.d.ts b/types/label.d.ts index 50346c48..b92c0c93 100644 --- a/types/label.d.ts +++ b/types/label.d.ts @@ -1,6 +1,7 @@ +import { BaiduMapComponent } from './base/component' import { Point, Size } from './base/common' -export declare class Label { +export declare class Label extends BaiduMapComponent { /** * 设置文本标注的内容。支持HTML */ diff --git a/types/local-search.d.ts b/types/local-search.d.ts index dbc634c9..c1f12143 100644 --- a/types/local-search.d.ts +++ b/types/local-search.d.ts @@ -1,3 +1,4 @@ +import { BaiduMapComponent } from './base/component' import { Point, Bounds, LocalResultPoi } from './base/common' interface Nearby { @@ -14,7 +15,7 @@ interface CustomData { filter: string } -export declare class LocalSearch { +export declare class LocalSearch extends BaiduMapComponent { /** * location表示检索区域,其类型可为空、坐标点或城市名称的字符串。当参数为空时, * 检索位置由当前地图中心点确定,且搜索结果的标注将自动加载到地图上,并支持调整地图视野层级; diff --git a/types/lushu.d.ts b/types/lushu.d.ts index a001ca09..becd3fd6 100644 --- a/types/lushu.d.ts +++ b/types/lushu.d.ts @@ -1,3 +1,4 @@ +import { BaiduMapComponent } from './base/component' import { Point, Size, Icon } from './base/common' interface LandmarkPois { @@ -7,7 +8,7 @@ interface LandmarkPois { pauseTime: number } -export declare class Lushu { +export declare class Lushu extends BaiduMapComponent { /** * 是否行进 * @default true diff --git a/types/map-type.d.ts b/types/map-type.d.ts index 8aab0ff1..69c9991a 100644 --- a/types/map-type.d.ts +++ b/types/map-type.d.ts @@ -1,4 +1,4 @@ -import { MapType, MapTypeControlType } from './base/common' +import { MapType as mt, MapTypeControlType } from './base/common' import { BaseControl } from './base/base-control' export declare class MapType extends BaseControl { @@ -9,5 +9,5 @@ export declare class MapType extends BaseControl { /** * 控件展示的地图类型,默认为普通图、卫星图、卫星加路网混合图和三维图。通过此属性可配置控件展示的地图类型 */ - mapTypes: MapType[] + mapTypes: mt[] } \ No newline at end of file diff --git a/types/map-view.d.ts b/types/map-view.d.ts index 471947b4..fc2452fd 100644 --- a/types/map-view.d.ts +++ b/types/map-view.d.ts @@ -1,3 +1,4 @@ +import { BaiduMapComponent } from './base/component' -export declare class MapView { +export declare class MapView extends BaiduMapComponent { } \ No newline at end of file diff --git a/types/map.d.ts b/types/map.d.ts index 0eb29d55..93202d3b 100644 --- a/types/map.d.ts +++ b/types/map.d.ts @@ -1,6 +1,7 @@ +import { BaiduMapComponent } from './base/component' import { MapType, Point, MapStyle } from './base/common' -export declare class Map { +export declare class Map extends BaiduMapComponent { /** * 百度地图开发者平台申请的密钥,仅在局部注册组件时声明。 */ diff --git a/types/marker-clusterer.d.ts b/types/marker-clusterer.d.ts index 64e52487..c6437ed9 100644 --- a/types/marker-clusterer.d.ts +++ b/types/marker-clusterer.d.ts @@ -1,6 +1,7 @@ +import { BaiduMapComponent } from './base/component' import { Point, Size, Icon, Animation } from './base/common' -export declare class MarkerClusterer { +export declare class MarkerClusterer extends BaiduMapComponent { /** * 网格大小 */ diff --git a/types/marker.d.ts b/types/marker.d.ts index 8dea832b..7b67007a 100644 --- a/types/marker.d.ts +++ b/types/marker.d.ts @@ -1,3 +1,4 @@ +import { BaiduMapComponent } from './base/component' import { Point, Size, Icon, Animation } from './base/common' interface Label { @@ -9,7 +10,7 @@ interface Label { } } -export declare class Marker { +export declare class Marker extends BaiduMapComponent { /** * 标注的位置 */ diff --git a/types/menu.d.ts b/types/menu.d.ts index 1a91eea9..fd039699 100644 --- a/types/menu.d.ts +++ b/types/menu.d.ts @@ -1,5 +1,6 @@ +import { BaiduMapComponent } from './base/component' -export declare class Menu { +export declare class Menu extends BaiduMapComponent { /** * 菜单宽度 */ diff --git a/types/overlay.d.ts b/types/overlay.d.ts index f71d7a8b..b2a87bcf 100644 --- a/types/overlay.d.ts +++ b/types/overlay.d.ts @@ -1,3 +1,4 @@ +import { BaiduMapComponent } from './base/component' type MapPanes = 'floatPane' // 信息窗口所在的容器 @@ -8,7 +9,7 @@ type MapPanes = | 'markerShadow' // 标注阴影所在的容器 | 'mapPane' // 折线、多边形等矢量图形所在的容器 -export declare class Overlay { +export declare class Overlay extends BaiduMapComponent { /** * 自定义覆盖物所在容器。 */ diff --git a/types/point-collection.d.ts b/types/point-collection.d.ts index ccf197d2..8ce0e6c5 100644 --- a/types/point-collection.d.ts +++ b/types/point-collection.d.ts @@ -1,6 +1,7 @@ +import { BaiduMapComponent } from './base/component' import { Point, ShapeType, SizeType } from './base/common' -export declare class PointCollection { +export declare class PointCollection extends BaiduMapComponent { /** * 设置要在地图上展示的点坐标集合 * @default [] diff --git a/types/polygon.d.ts b/types/polygon.d.ts index 7425673a..da0d5e10 100644 --- a/types/polygon.d.ts +++ b/types/polygon.d.ts @@ -1,6 +1,7 @@ +import { BaiduMapComponent } from './base/component' import { Point } from './base/common' -export declare class Polygon { +export declare class Polygon extends BaiduMapComponent { /** * 设置多边型的点数组 * @default [] diff --git a/types/polyline.d.ts b/types/polyline.d.ts index c6e44a22..bc2957da 100644 --- a/types/polyline.d.ts +++ b/types/polyline.d.ts @@ -1,6 +1,7 @@ +import { BaiduMapComponent } from './base/component' import { IconSequence, Point } from './base/common' -export declare class Polyline { +export declare class Polyline extends BaiduMapComponent { /** * 设置折线的点数组 * @default [] diff --git a/types/tile.d.ts b/types/tile.d.ts index f6802843..aa2ac097 100644 --- a/types/tile.d.ts +++ b/types/tile.d.ts @@ -1,6 +1,7 @@ +import { BaiduMapComponent } from './base/component' import { Copyright } from './base/common' -export declare class Tile { +export declare class Tile extends BaiduMapComponent { /** * 是否使用了带有透明信息的PNG。 * 由于IE6不支持PNG透明,因此需要特殊处理 diff --git a/types/traffic.d.ts b/types/traffic.d.ts index 47b80d32..488844ff 100644 --- a/types/traffic.d.ts +++ b/types/traffic.d.ts @@ -1,6 +1,7 @@ +import { BaiduMapComponent } from './base/component' import { PredictDate } from './base/common' -export declare class Traffic { +export declare class Traffic extends BaiduMapComponent { /** * 预测日期 */ diff --git a/types/transit.d.ts b/types/transit.d.ts index fc13141a..4ce90f4d 100644 --- a/types/transit.d.ts +++ b/types/transit.d.ts @@ -1,6 +1,7 @@ +import { BaiduMapComponent } from './base/component' import { Point, LocalResultPoi, TransitPolicy } from './base/common' -export declare class Transit { +export declare class Transit extends BaiduMapComponent { /** * location表示检索区域,其类型可为空、坐标点或城市名称的字符串。当参数为空时, * 检索位置由当前地图中心点确定,且搜索结果的标注将自动加载到地图上,并支持调整地图视野层级; diff --git a/types/walking.d.ts b/types/walking.d.ts index 47c5b0dc..2c295cbf 100644 --- a/types/walking.d.ts +++ b/types/walking.d.ts @@ -1,6 +1,7 @@ +import { BaiduMapComponent } from './base/component' import { Point, LocalResultPoi, TransitPolicy } from './base/common' -export declare class Walking { +export declare class Walking extends BaiduMapComponent { /** * location表示检索区域,其类型可为空、坐标点或城市名称的字符串。当参数为空时, * 检索位置由当前地图中心点确定,且搜索结果的标注将自动加载到地图上,并支持调整地图视野层级;