docs(Dialog): add jsx faq (#8624)

This commit is contained in:
neverland
2021-04-26 20:57:08 +08:00
committed by GitHub
parent 0e1609f017
commit 324fd08f3d
2 changed files with 30 additions and 4 deletions
+14 -1
View File
@@ -6,7 +6,7 @@
### 函数调用
Dialog 是一个函数,调用后会直接在页面中弹出相应的模态框。
`Dialog` 是一个函数,调用后会直接在页面中弹出相应的模态框。
```js
import { Dialog } from 'vant';
@@ -288,3 +288,16 @@ Dialog.alert({
// on close
});
```
### 在 JSX 中渲染 Dialog 组件无法展示?
请注意 `Dialog` 是一个函数,`Dialog.Component` 才是 Dialog 对应的组件。JSX 调用弹窗的正确姿势如下:
```jsx
export default {
setup() {
const show = ref(false);
return () => <Dialog.Component v-model={[show, 'show']} />;
},
};
```