docs(Dialog): add jsx faq (#8624)
This commit is contained in:
@@ -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']} />;
|
||||
},
|
||||
};
|
||||
```
|
||||
|
||||
Reference in New Issue
Block a user