Skip to content

Commit

Permalink
docs: 更新 apiUrl 和配置相关内容
Browse files Browse the repository at this point in the history
  • Loading branch information
yue1123 committed Sep 12, 2023
1 parent a93e231 commit e512c65
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 17 deletions.
21 changes: 11 additions & 10 deletions docs/zh-CN/components/map.md
Original file line number Diff line number Diff line change
Expand Up @@ -124,16 +124,17 @@ map/theme2

## 静态组件 props

| 属性 | 说明 | 类型 | 可选值 | 默认值 | 版本 |
| ----------------- | -------------------------------------------------------- | ----------------------------------------------------------------------- | ------ | ---------------------- | ---------------------------------- |
| ak | 百度地图 ak [申请 ak](../guide/quick-start#申请-ak-密钥) | `string` | - | - | - |
| minZoom | 地图允许展示的最小级别 | `number` | `0-21` | `0` | - |
| maxZoom | 地图允许展示的最大级别 | `number` | `0-21` | `21` | - |
| backgroundColor | 地图背景颜色, rgba 数组 | ` number[]` | - | `[245, 245, 245, 100]` | <Badge type="tip" text="^2.1.0" /> |
| showControls | 是否显示室内图 | `boolean` | - | `false` | - |
| restrictCenter | 是否限制中心 | `boolean` | - | `true` | <Badge type="tip" text="^1.1.3" /> |
| plugins | 需要注册的插件 | `['TrackAnimation', 'Mapvgl', 'Mapv', 'MapvThree']` | - | - | - |
| pluginsSourceLink | 自定义插件资源地址 | `Record<'TrackAnimation' \| 'Mapvgl' \| 'Mapv' \| 'MapvThree', string>` | - | - | - |
| 属性 | 说明 | 类型 | 可选值 | 默认值 | 版本 |
| ----------------- | ------------------------------------------------ | ----------------------------------------------------------------------- | ------ | ---------------------- | ---------------------------------- |
| ak | 百度地图 [ak](../guide/quick-start#申请-ak-密钥) | `string` | - | - | - |
| apiUrl | 自建地图 api 资源地址(一般用于离线地图) | `string` | - | - | <Badge type="tip" text="^2.3.0" /> |
| minZoom | 地图允许展示的最小级别 | `number` | `0-21` | `0` | - |
| maxZoom | 地图允许展示的最大级别 | `number` | `0-21` | `21` | - |
| backgroundColor | 地图背景颜色, rgba 数组 | ` number[]` | - | `[245, 245, 245, 100]` | <Badge type="tip" text="^2.1.0" /> |
| showControls | 是否显示室内图 | `boolean` | - | `false` | - |
| restrictCenter | 是否限制中心 | `boolean` | - | `true` | <Badge type="tip" text="^1.1.3" /> |
| plugins | 需要注册的插件 | `['TrackAnimation', 'Mapvgl', 'Mapv', 'MapvThree']` | - | - | - |
| pluginsSourceLink | 自定义插件资源地址 | `Record<'TrackAnimation' \| 'Mapvgl' \| 'Mapv' \| 'MapvThree', string>` | - | - | - |

## 动态组件 Props

Expand Down
27 changes: 20 additions & 7 deletions docs/zh-CN/guide/config.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,26 @@ lang: zh-CN

# 配置

本章节将为你讲述如何配置 ak 与插件以及更换资源链接,并实现一个自定义插件
本章节将为你讲述如何配置 ak、apiUrl 与插件以及更换资源链接,并实现一个自定义插件

## 配置方式

::: tip
`ak``plugins``pluginsSourceLink`都支持两种来源(全局注册配置和组件 `props` 提供),当同时指定的时候,会优先就近原则,从组件 `props` 中获取。如果全局注册配置和组件 `props` 都提供了,则会尝试合并两个配置
如果你是**全局注册**使用方式,那么`ak``apiUrl``plugins``pluginsSourceLink` 都支持两种来源(全局注册配置和组件 `props` 提供),当同时指定的时候,会优先就近原则,从组件 `props` 中获取。如果全局注册配置和组件 `props` 都提供了,则会尝试合并两个配置。

如果你是**按需加载**使用方式,则只支持组件 `props` 方式
:::

## 通过全局注册配置 ak 与 插件
### 1. 通过全局注册配置 ak 与 插件

全局注册 Options

| 属性 | 说明 | 类型 | 可选值 | 默认值 | 版本 |
| ----------------- | ------------------------------------------------ | ----------------------------------------------------------------------- | ------ | ------ | ---------------------------------- |
| ak | 百度地图 [ak](../guide/quick-start#申请-ak-密钥) | `string` | - | - | - |
| apiUrl | 自建地图 api 资源地址(一般用于离线地图) | `string` | - | - | <Badge type="tip" text="^2.3.0" /> |
| plugins | 需要注册的插件 | `['TrackAnimation', 'Mapvgl', 'Mapv', 'MapvThree']` | - | - | - |
| pluginsSourceLink | 自定义插件资源地址 | `Record<'TrackAnimation' \| 'Mapvgl' \| 'Mapv' \| 'MapvThree', string>` | - | - | - |

```ts{7,8}
import { createApp } from 'vue'
Expand All @@ -26,11 +39,11 @@ app.use(baiduMap, {
app.mount('#app')
```

## 组件 `Map` 传入 `props` 配置
### 组件 `BMap` 传入 [`props`](/zh-CN/components/map#%E9%9D%99%E6%80%81%E7%BB%84%E4%BB%B6-props) 配置

<!-- prettier-ignore -->
```html{2,3}
<Map
<BMap
ak='百度地图ak'
:plugins="['TrackAnimation']"
/>
Expand All @@ -55,7 +68,7 @@ app.use(baiduMap, {

<!-- prettier-ignore -->
```html{2-5}
<Map
<BMap
:plugins=['TrackAnimation']
:pluginsSourceLink="{
TrackAnimation: '自建或其他地址的资源链接'
Expand Down Expand Up @@ -92,5 +105,5 @@ app.use(baiduMap, {

<!-- prettier-ignore -->
```html
<Map :plugins="[customPlugin]" />
<BMap :plugins="[customPlugin]" />
```

0 comments on commit e512c65

Please sign in to comment.