docs: add teleport link (#9176)

This commit is contained in:
neverland
2021-08-04 10:14:57 +08:00
committed by GitHub
parent d6e5dcb813
commit 46cbdfa8ce
22 changed files with 32 additions and 62 deletions
-16
View File
@@ -98,24 +98,8 @@ Use `teleport` prop to specify mount location.
<!-- teleport to #app -->
<van-popup v-model:show="show" teleport="#app" />
<!-- teleport to Element -->
<van-popup v-model:show="show" :teleport="myContainer" />
```
```js
export default {
setup() {
const myContainer = document.querySelector('.my-container');
return {
myContainer,
};
},
};
```
> Tips: The teleport prop cannot be used on the root node
## API
### Props
+2 -16
View File
@@ -104,20 +104,6 @@ export default {
<!-- 挂载到 #app 节点下 -->
<van-popup v-model:show="show" teleport="#app" />
<!-- 挂载到指定的元素下 -->
<van-popup v-model:show="show" :teleport="myContainer" />
```
```js
export default {
setup() {
const myContainer = document.querySelector('.my-container');
return {
myContainer,
};
},
};
```
## API
@@ -141,10 +127,10 @@ export default {
| close-icon | 关闭[图标名称](#/zh-CN/icon)或图片链接 | _string_ | `cross` |
| close-icon-position | 关闭图标位置,可选值为 `top-left`<br>`bottom-left` `bottom-right` | _string_ | `top-right` |
| before-close `v3.1.4` | 关闭前的回调函数,返回 `false` 可阻止关闭,支持返回 Promise | _(action: string) => boolean \| Promise\<boolean\>_ | - |
| icon-prefix `v3.0.18` | 图标类名前缀, Icon 组件的 [class-prefix 属性](#/zh-CN/icon#props) | _string_ | `van-icon` |
| icon-prefix `v3.0.18` | 图标类名前缀,等同于 Icon 组件的 [class-prefix 属性](#/zh-CN/icon#props) | _string_ | `van-icon` |
| transition | 动画类名,等价于 [transition](https://v3.cn.vuejs.org/api/built-in-components.html#transition) 的 `name` 属性 | _string_ | - |
| transition-appear | 是否在初始渲染时启用过渡动画 | _boolean_ | `false` |
| teleport | 指定挂载的节点 | _string \| Element_ | - |
| teleport | 指定挂载的节点,等同于 Teleport 组件的 [to 属性](https://v3.cn.vuejs.org/api/built-in-components.html#teleport) | _string \| Element_ | - |
| safe-area-inset-bottom | 是否开启[底部安全区适配](#/zh-CN/advanced-usage#di-bu-an-quan-qu-gua-pei) | _boolean_ | `false` |
### Events