8000 docs(Dialog): 完善对Dialog中使用openType的文档与示例 by LvJiaLei666 · Pull Request #763 · AntmJS/vantui · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

docs(Dialog): 完善对Dialog中使用openType的文档与示例 #763

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
44 changes: 25 additions & 19 deletions packages/vantui/src/dialog/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,12 @@ import { Dialog } from '@antmjs/vantui'

::: $demo4 :::

### 开放能力

如需使用开放能力,需要使用组件的异步关闭能力(PS:以微信为例,如果在点击后`弹窗关闭/按钮消失`则会获取不到微信小程序提供的信息,所以需要使用`beforeClose`,获取到开放信息后再关闭弹窗)。

::: $demo5 :::

### DialogProps [[详情]](https://github.com/AntmJS/vantui/tree/main/packages/vantui/types/dialog.d.ts)

| 参数 | 说明 | 类型 | 默认值 | 必填 |
Expand Down Expand Up @@ -91,22 +97,22 @@ import { Dialog } from '@antmjs/vantui'

组件提供了下列 CSS 变量,可用于自定义样式,使用方法请参考[ConfigProvider 组件](https://antmjs.github.io/vantui/#/config-provider)

| 名称 | 默认值 |
| -------------------------------------- | --------------------- |
| --dialog-width | ` 640px;` |
| --dialog-small-screen-width | ` 90%;` |
| --dialog-font-size | ` @font-size-lg;` |
| --dialog-border-radius | ` 32px;` |
| --dialog-background-color | ` @white;` |
| --dialog-header-font-weight | ` @font-weight-bold;` |
| --dialog-header-line-height | ` 48px;` |
| --dialog-header-padding-top | ` @padding-lg;` |
| --dialog-header-isolated-padding | ` @padding-lg 0;` |
| --dialog-message-padding | ` @padding-lg;` |
| --dialog-message-font-size | ` @font-size-md;` |
| --dialog-message-line-height | ` 40px;` |
| --dialog-message-max-height | ` 60vh;` |
| --dialog-has-title-message-text-color | ` @gray-7;` |
| --dialog-has-title-message-padding-top | ` @padding-xs;` |
| --dialog-cancel-button-color | ` @gray-7;` |
| --dialog-confirm-button-color | ` @text-link-color;` |
| 名称 | 默认值 |
| -------------------------------------- | -------------------- |
| --dialog-width | `640px;` |
| --dialog-small-screen-width | `90%;` |
| --dialog-font-size | `@font-size-lg;` |
| --dialog-border-radius | `32px;` |
| --dialog-background-color | `@white;` |
| --dialog-header-font-weight | `@font-weight-bold;` |
| --dialog-header-line-height | `48px;` |
| --dialog-header-padding-top | `@padding-lg;` |
| --dialog-header-isolated-padding | `@padding-lg 0;` |
| --dialog-message-padding | `@padding-lg;` |
| --dialog-message-font-size | `@font-size-md;` |
| --dialog-message-line-height | `40px;` |
| --dialog-message-max-height | `60vh;` |
| --dialog-has-title-message-text-color | `@gray-7;` |
| --dialog-has-title-message-padding-top | `@padding-xs;` |
| --dialog-cancel-button-color | `@gray-7;` |
| --dialog-confirm-button-color | `@text-link-color;` |
8 changes: 7 additions & 1 deletion packages/vantui/src/dialog/demo/demo5.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,19 @@
import react from 'react'
import { View } from '@tarojs/components'
import { Dialog, Cell } from '@antmjs/vantui'
import Taro from '@tarojs/taro'

export default function Demo() {
const beforeCloseResolve = react.useRef<(result: boolean) => void>()
const alert = react.useCallback((title) => {
const beforeClose = (): Promise<boolean> => {
return new Promise((resolve) => {
beforeCloseResolve.current = resolve
// 微信小程序
if (Taro.getEnv() === Taro.ENV_TYPE.WEAPP) {
beforeCloseResolve.current = resolve
} else {
resolve(true)
}
})
}
Dialog.alert({
Expand Down
Loading
0