mirror of
https://gitee.com/vant-contrib/vant.git
synced 2025-04-06 03:57:59 +08:00
docs: add usage of function component in script setup (#9517)
This commit is contained in:
parent
ddecb3a2d0
commit
327436e3fb
@ -34,6 +34,21 @@ export default {
|
||||
};
|
||||
```
|
||||
|
||||
在 `script setup` 中,可以通过以下方式使用:
|
||||
|
||||
```html
|
||||
<script setup>
|
||||
const VanDialog = Dialog.Component;
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<!-- 中划线命名 -->
|
||||
<van-dialog />
|
||||
<!-- 也支持大驼峰命名 -->
|
||||
<VanDialog>
|
||||
</template>
|
||||
```
|
||||
|
||||
## 代码演示
|
||||
|
||||
### 消息提示
|
||||
|
@ -34,6 +34,21 @@ export default {
|
||||
};
|
||||
```
|
||||
|
||||
在 `script setup` 中,可以通过以下方式使用:
|
||||
|
||||
```html
|
||||
<script setup>
|
||||
const VanImagePreview = ImagePreview.Component;
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<!-- 中划线命名 -->
|
||||
<van-image-preview />
|
||||
<!-- 也支持大驼峰命名 -->
|
||||
<VanImagePreview>
|
||||
</template>
|
||||
```
|
||||
|
||||
## 代码演示
|
||||
|
||||
### 基础用法
|
||||
|
@ -34,6 +34,21 @@ export default {
|
||||
};
|
||||
```
|
||||
|
||||
在 `script setup` 中,可以通过以下方式使用:
|
||||
|
||||
```html
|
||||
<script setup>
|
||||
const VanNotify = Notify.Component;
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<!-- 中划线命名 -->
|
||||
<van-notify />
|
||||
<!-- 也支持大驼峰命名 -->
|
||||
<VanNotify>
|
||||
</template>
|
||||
```
|
||||
|
||||
## 代码演示
|
||||
|
||||
### 基础用法
|
||||
|
Loading…
x
Reference in New Issue
Block a user