docs: add usage of function component in script setup (#9517)

This commit is contained in:
neverland 2021-09-19 11:25:51 +08:00 committed by GitHub
parent ddecb3a2d0
commit 327436e3fb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 45 additions and 0 deletions

View File

@ -34,6 +34,21 @@ export default {
};
```
`script setup` 中,可以通过以下方式使用:
```html
<script setup>
const VanDialog = Dialog.Component;
</script>
<template>
<!-- 中划线命名 -->
<van-dialog />
<!-- 也支持大驼峰命名 -->
<VanDialog>
</template>
```
## 代码演示
### 消息提示

View File

@ -34,6 +34,21 @@ export default {
};
```
`script setup` 中,可以通过以下方式使用:
```html
<script setup>
const VanImagePreview = ImagePreview.Component;
</script>
<template>
<!-- 中划线命名 -->
<van-image-preview />
<!-- 也支持大驼峰命名 -->
<VanImagePreview>
</template>
```
## 代码演示
### 基础用法

View File

@ -34,6 +34,21 @@ export default {
};
```
`script setup` 中,可以通过以下方式使用:
```html
<script setup>
const VanNotify = Notify.Component;
</script>
<template>
<!-- 中划线命名 -->
<van-notify />
<!-- 也支持大驼峰命名 -->
<VanNotify>
</template>
```
## 代码演示
### 基础用法