sard-uniapp 1.19.2 → 1.19.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +10 -0
- package/components/accordion/README.md +91 -0
- package/components/accordion/accordion.vue +7 -0
- package/components/accordion-item/accordion-item.vue +9 -0
- package/components/action-sheet/README.md +85 -0
- package/components/action-sheet/action-sheet.vue +15 -0
- package/components/alert/README.md +74 -0
- package/components/alert/alert.vue +10 -0
- package/components/avatar/README.md +86 -0
- package/components/avatar/avatar.vue +8 -0
- package/components/back-top/README.md +134 -0
- package/components/back-top/back-top.vue +9 -0
- package/components/badge/README.md +95 -0
- package/components/badge/badge.vue +11 -0
- package/components/button/README.md +162 -0
- package/components/button/button.vue +46 -0
- package/components/calendar/README.md +94 -0
- package/components/calendar/calendar.vue +19 -0
- package/components/calendar-input/README.md +65 -0
- package/components/calendar-input/calendar-input.vue +31 -0
- package/components/calendar-popout/README.md +100 -0
- package/components/calendar-popout/calendar-popout.vue +25 -0
- package/components/card/README.md +82 -0
- package/components/card/card.vue +9 -0
- package/components/cascader/README.md +117 -0
- package/components/cascader/cascader.vue +13 -0
- package/components/cascader-input/README.md +51 -0
- package/components/cascader-input/cascader-input.vue +25 -0
- package/components/cascader-popout/README.md +53 -0
- package/components/cascader-popout/cascader-popout.vue +19 -0
- package/components/checkbox/README.md +185 -0
- package/components/checkbox/checkbox.vue +17 -0
- package/components/checkbox-group/checkbox-group.vue +15 -0
- package/components/checkbox-input/README.md +44 -0
- package/components/checkbox-input/checkbox-input.vue +22 -0
- package/components/checkbox-popout/README.md +52 -0
- package/components/checkbox-popout/checkbox-popout.vue +19 -0
- package/components/col/col.vue +7 -0
- package/components/collapse/README.md +45 -0
- package/components/collapse/collapse.vue +3 -0
- package/components/config/index.d.ts +2 -0
- package/components/config/index.js +1 -0
- package/components/count-down/README.md +97 -0
- package/components/count-down/count-down.vue +8 -0
- package/components/count-to/README.md +61 -0
- package/components/count-to/count-to.vue +7 -0
- package/components/crop-image/README.md +86 -0
- package/components/crop-image/crop-image.vue +15 -0
- package/components/datetime-picker/README.md +136 -0
- package/components/datetime-picker/datetime-picker.vue +14 -0
- package/components/datetime-picker-input/README.md +82 -0
- package/components/datetime-picker-input/datetime-picker-input.vue +25 -0
- package/components/datetime-picker-popout/README.md +77 -0
- package/components/datetime-picker-popout/datetime-picker-popout.vue +19 -0
- package/components/datetime-range-picker/README.md +49 -0
- package/components/datetime-range-picker/datetime-range-picker.vue +15 -0
- package/components/datetime-range-picker-input/README.md +58 -0
- package/components/datetime-range-picker-input/datetime-range-picker-input.vue +26 -0
- package/components/datetime-range-picker-popout/README.md +53 -0
- package/components/datetime-range-picker-popout/datetime-range-picker-popout.vue +20 -0
- package/components/dialog/README.md +192 -0
- package/components/dialog/dialog.vue +33 -0
- package/components/dialog-agent/dialog-agent.vue +21 -0
- package/components/divider/README.md +80 -0
- package/components/divider/divider.vue +8 -0
- package/components/dropdown/README.md +168 -0
- package/components/dropdown/common.d.ts +7 -0
- package/components/dropdown/common.js +1 -0
- package/components/dropdown/dropdown.vue +16 -1
- package/components/dropdown-item/dropdown-item.vue +51 -4
- package/components/empty/README.md +71 -0
- package/components/empty/empty.vue +8 -0
- package/components/fab/README.md +111 -0
- package/components/fab/fab.vue +18 -0
- package/components/floating-bubble/README.md +70 -0
- package/components/floating-bubble/floating-bubble.vue +11 -0
- package/components/floating-panel/README.md +78 -0
- package/components/floating-panel/floating-panel.vue +11 -0
- package/components/form/README.md +308 -0
- package/components/form/form.vue +19 -0
- package/components/form-item/form-item.vue +17 -0
- package/components/grid/README.md +140 -0
- package/components/grid/grid.vue +11 -0
- package/components/grid-item/grid-item.vue +15 -0
- package/components/icon/README.md +118 -0
- package/components/icon/common.d.ts +2 -0
- package/components/icon/icon.d.ts +1 -0
- package/components/icon/icon.vue +18 -3
- package/components/indexes/README.md +83 -0
- package/components/indexes/indexes.vue +7 -0
- package/components/indexes-anchor/indexes-anchor.vue +5 -0
- package/components/input/README.md +170 -0
- package/components/input/input.vue +55 -0
- package/components/keyboard/README.md +82 -0
- package/components/keyboard/keyboard.vue +7 -0
- package/components/layout/README.md +89 -0
- package/components/list/README.md +118 -0
- package/components/list/list.vue +8 -0
- package/components/list-item/list-item.vue +15 -0
- package/components/load-more/README.md +75 -0
- package/components/load-more/load-more.vue +11 -0
- package/components/loading/README.md +89 -0
- package/components/loading/loading.vue +13 -0
- package/components/lucky-draw/README.md +174 -0
- package/components/marquee/README.md +65 -0
- package/components/marquee/marquee.vue +7 -0
- package/components/menu/_README.md +61 -0
- package/components/navbar/README.md +123 -0
- package/components/navbar/navbar.vue +11 -0
- package/components/navbar-item/navbar-item.vue +10 -0
- package/components/notice-bar/README.md +135 -0
- package/components/notice-bar/notice-bar.vue +17 -0
- package/components/notify/README.md +118 -0
- package/components/notify/notify.vue +11 -0
- package/components/notify-agent/notify-agent.vue +12 -0
- package/components/overlay/README.md +56 -0
- package/components/overlay/overlay.vue +10 -0
- package/components/pagination/README.md +80 -0
- package/components/pagination/pagination.vue +15 -0
- package/components/password-input/README.md +87 -0
- package/components/password-input/password-input.vue +17 -0
- package/components/picker/README.md +115 -0
- package/components/picker/picker.vue +10 -0
- package/components/picker-input/README.md +51 -0
- package/components/picker-input/picker-input.vue +21 -0
- package/components/picker-popout/README.md +51 -0
- package/components/picker-popout/picker-popout.vue +15 -0
- package/components/popout/README.md +111 -0
- package/components/popout/popout.vue +29 -0
- package/components/popout-input/README.md +55 -0
- package/components/popout-input/popout-input.vue +15 -0
- package/components/popover/README.md +191 -0
- package/components/popover/popover.vue +15 -0
- package/components/popover-reference/popover-reference.vue +5 -0
- package/components/popup/README.md +67 -0
- package/components/popup/popup.vue +20 -0
- package/components/progress-bar/README.md +90 -0
- package/components/progress-bar/progress-bar.vue +13 -0
- package/components/progress-circle/README.md +75 -0
- package/components/progress-circle/progress-circle.vue +10 -0
- package/components/pull-down-refresh/README.md +100 -0
- package/components/pull-down-refresh/pull-down-refresh.vue +11 -0
- package/components/qrcode/README.md +103 -0
- package/components/qrcode/qrcode.vue +13 -0
- package/components/radio/README.md +172 -0
- package/components/radio/radio.vue +13 -0
- package/components/radio-group/radio-group.vue +16 -0
- package/components/radio-input/README.md +44 -0
- package/components/radio-input/radio-input.vue +23 -0
- package/components/radio-popout/README.md +52 -0
- package/components/radio-popout/radio-popout.vue +20 -0
- package/components/rate/README.md +106 -0
- package/components/rate/rate.vue +22 -0
- package/components/result/README.md +66 -0
- package/components/result/result.vue +10 -0
- package/components/row/row.vue +7 -0
- package/components/scroll-spy/README.md +70 -0
- package/components/scroll-spy/scroll-spy.vue +13 -0
- package/components/search/README.md +117 -0
- package/components/search/search.vue +25 -0
- package/components/share-sheet/README.md +94 -0
- package/components/share-sheet/share-sheet.vue +20 -0
- package/components/sidebar/README.md +118 -0
- package/components/sidebar/sidebar.vue +10 -0
- package/components/sidebar-item/sidebar-item.vue +8 -0
- package/components/signature/README.md +99 -0
- package/components/signature/signature.vue +20 -0
- package/components/skeleton/README.md +128 -0
- package/components/skeleton/skeleton.vue +12 -0
- package/components/skeleton-avatar/skeleton-avatar.vue +9 -0
- package/components/skeleton-block/skeleton-block.vue +8 -0
- package/components/skeleton-paragraph/skeleton-paragraph.vue +9 -0
- package/components/skeleton-title/skeleton-title.vue +8 -0
- package/components/slider/README.md +140 -0
- package/components/slider/slider.vue +29 -0
- package/components/space/README.md +82 -0
- package/components/space/space.vue +9 -0
- package/components/status-bar/README.md +72 -0
- package/components/status-bar/status-bar.vue +6 -0
- package/components/step/step.vue +9 -1
- package/components/stepper/README.md +94 -0
- package/components/stepper/stepper.vue +24 -0
- package/components/steps/README.md +142 -0
- package/components/steps/steps.vue +15 -0
- package/components/style/README.md +20 -0
- package/components/swipe-action/README.md +82 -0
- package/components/swipe-action/swipe-action.vue +7 -0
- package/components/swiper-dot/README.md +45 -0
- package/components/swiper-dot/swiper-dot.vue +9 -0
- package/components/switch/README.md +89 -0
- package/components/switch/switch.vue +18 -0
- package/components/tab/tab.vue +8 -0
- package/components/tabbar/README.md +111 -0
- package/components/tabbar/tabbar.vue +12 -0
- package/components/tabbar-item/tabbar-item.vue +12 -0
- package/components/tabbar-pit/README.md +41 -0
- package/components/tabbar-pit/tabbar-pit.vue +5 -0
- package/components/table/README.md +162 -0
- package/components/table/table.vue +7 -0
- package/components/table-cell/table-cell.vue +7 -0
- package/components/table-row/table-row.vue +5 -0
- package/components/tabs/README.md +113 -0
- package/components/tabs/tabs.vue +10 -0
- package/components/tag/README.md +96 -0
- package/components/tag/tag.vue +14 -0
- package/components/timeline/README.md +66 -0
- package/components/timeline/timeline.vue +4 -0
- package/components/timeline-item/timeline-item.vue +9 -0
- package/components/toast/README.md +111 -0
- package/components/toast/toast.vue +11 -0
- package/components/toast-agent/toast-agent.vue +11 -0
- package/components/tree/README.md +208 -0
- package/components/tree/tree.vue +21 -0
- package/components/upload/README.md +154 -0
- package/components/upload/upload.vue +22 -0
- package/package.json +74 -45
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
---
|
|
2
|
+
nav: 组件
|
|
3
|
+
title: DatetimePickerInput
|
|
4
|
+
subtitle: 日期时间输入框
|
|
5
|
+
group: 表单组件
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
## 介绍
|
|
9
|
+
|
|
10
|
+
组合了日期时间弹出框、输入框组件,实现了便捷快速的日期选择功能。
|
|
11
|
+
|
|
12
|
+
## 引入
|
|
13
|
+
|
|
14
|
+
```ts
|
|
15
|
+
import DatetimePickerInput from 'sard-uniapp/components/datetime-picker-input/datetime-picker-input.vue'
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
## 代码演示
|
|
19
|
+
|
|
20
|
+
### 基础使用
|
|
21
|
+
|
|
22
|
+
使用 `v-model` 绑定当前值,通过 `title` 和 `placeholder` 属性设置弹出框标题和输入框占位文本。
|
|
23
|
+
|
|
24
|
+
在点击输入框后会显示日期时间弹出框。
|
|
25
|
+
|
|
26
|
+
@code('${DEMO_PATH}/datetime-picker-input/demo/Basic.vue')
|
|
27
|
+
|
|
28
|
+
### 输入框日期格式
|
|
29
|
+
|
|
30
|
+
使用 `outlet-format` 属性自定义输入框日期展示的格式。
|
|
31
|
+
|
|
32
|
+
@code('${DEMO_PATH}/datetime-picker-input/demo/OutletFormat.vue')
|
|
33
|
+
|
|
34
|
+
### 绑定值的格式
|
|
35
|
+
|
|
36
|
+
默认绑定的值为 `Date` 实例,提交到后端时需要手动转换为特定格式的字符串;使用 `value-format` 属性可以将这个转换交由组件库处理。
|
|
37
|
+
|
|
38
|
+
@code('${DEMO_PATH}/datetime-picker-input/demo/ValueFormat.vue')
|
|
39
|
+
|
|
40
|
+
### min、max 联动
|
|
41
|
+
|
|
42
|
+
可以通过 `min` 和 `max` 属性使两个选择器联动。
|
|
43
|
+
|
|
44
|
+
选择日期时间范围,使用 `DatetimeRangePickerInput` 是更好的选择。
|
|
45
|
+
|
|
46
|
+
@code('${DEMO_PATH}/datetime-picker-input/demo/Range.vue')
|
|
47
|
+
|
|
48
|
+
## API
|
|
49
|
+
|
|
50
|
+
### DatetimePickerInputProps
|
|
51
|
+
|
|
52
|
+
继承 [`DatetimePickerPopoutProps`](./datetime-picker-popout#DatetimePickerPopoutProps) 并有以下额外属性:
|
|
53
|
+
|
|
54
|
+
| 属性 | 描述 | 类型 | 默认值 |
|
|
55
|
+
| --------------------------------- | ------------------------------------------------------------ | ----------------------------------------------------- | --------------- |
|
|
56
|
+
| root-class | 弹出式输入框根元素类名 | string | - |
|
|
57
|
+
| root-style | 弹出式输入框根元素样式 | StyleValue | - |
|
|
58
|
+
| disabled | 禁用状态 | boolean | false |
|
|
59
|
+
| readonly | 只读状态 | boolean | false |
|
|
60
|
+
| clearable | 是否显示清空按钮 | boolean | false |
|
|
61
|
+
| placeholder | 输入框占位符内容 | string | - |
|
|
62
|
+
| outlet-format | 输出到输入框的日期格式,不指定则根据 `type` 属性自动生成格式 | string [详见特殊符号](../guide/date#日期格式特殊符号) | - |
|
|
63
|
+
| value-on-clear <sup>1.19.2+</sup> | 设置点击清除按钮后的值 | () => any | () => undefined |
|
|
64
|
+
|
|
65
|
+
### `type` 到 `outletFormat` 的映射:
|
|
66
|
+
|
|
67
|
+
```ts
|
|
68
|
+
const mapTypeFormat = {
|
|
69
|
+
y: 'YYYY',
|
|
70
|
+
yM: 'YYYY-MM',
|
|
71
|
+
yMd: 'YYYY-MM-DD',
|
|
72
|
+
yMdh: 'YYYY-MM-DD HH',
|
|
73
|
+
yMdhm: 'YYYY-MM-DD HH:mm',
|
|
74
|
+
yMdhms: 'YYYY-MM-DD HH:mm:ss',
|
|
75
|
+
hm: 'HH:mm',
|
|
76
|
+
hms: 'HH:mm:ss',
|
|
77
|
+
}
|
|
78
|
+
```
|
|
79
|
+
|
|
80
|
+
### DatetimePickerInputEmits
|
|
81
|
+
|
|
82
|
+
继承 [`DatetimePickerPopoutEmits`](./datetime-picker-popout#DatetimePickerPopoutEmits)
|
|
@@ -41,6 +41,31 @@ import {
|
|
|
41
41
|
defaultDatetimePickerInputProps,
|
|
42
42
|
mapTypeFormat
|
|
43
43
|
} from "./common";
|
|
44
|
+
/**
|
|
45
|
+
* @property {string} rootClass 弹出式输入框根元素类名,默认值:-。
|
|
46
|
+
* @property {StyleValue} rootStyle 弹出式输入框根元素样式,默认值:-。
|
|
47
|
+
* @property {string [详见特殊符号](#DatetimeLetter)} type 设置每一列要展示的数据类型,每个字母对应一列,默认值:'yMd'。
|
|
48
|
+
* @property {'solar' | 'lunar'} calendar 历法类型,可选公历或农历,默认值:'solar'。
|
|
49
|
+
* @property {Date} min 可选的最小日期,默认值:十年前。
|
|
50
|
+
* @property {Date} max 可选的最大日期,默认值:十年后。
|
|
51
|
+
* @property {Date | string} modelValue 当前选中的日期,默认值:-。
|
|
52
|
+
* @property {(letter: DatetimeLetter, value: number, date: Date, index: number) => boolean} filter 选项的过滤函数,默认值:-。
|
|
53
|
+
* @property {(letter: DatetimeLetter, option: DatetimeColumnOption, date: Date, index: number) => string | void |undefined} formatter 选项的格式化函数,默认值:-。
|
|
54
|
+
* @property {string [详见特殊符号](../guide/date#日期格式特殊符号)} valueFormat 绑定值的格式,不指定则绑定值为 Date 对象,默认值:-。
|
|
55
|
+
* @property {string} popoutClass 弹窗框根元素类名,默认值:-。
|
|
56
|
+
* @property {StyleValue} popoutStyle 弹窗框根元素样式,默认值:-。
|
|
57
|
+
* @property {boolean} visible 是否显示弹出框,默认值:-。
|
|
58
|
+
* @property {string} title 弹出框标题,默认值:-。
|
|
59
|
+
* @property {boolean} validateEvent 是否触发表单验证,默认值:true。
|
|
60
|
+
* @property {boolean} disabled 禁用状态,默认值:false。
|
|
61
|
+
* @property {boolean} readonly 只读状态,默认值:false。
|
|
62
|
+
* @property {boolean} clearable 是否显示清空按钮,默认值:false。
|
|
63
|
+
* @property {string} placeholder 输入框占位符内容,默认值:-。
|
|
64
|
+
* @property {string [详见特殊符号](../guide/date#日期格式特殊符号)} outletFormat 输出到输入框的日期格式,不指定则根据 `type` 属性自动生成格式,默认值:-。
|
|
65
|
+
* @property {() => any} valueOnClear 设置点击清除按钮后的值,默认值:() => undefined。
|
|
66
|
+
* @event {(visible: boolean) => void} update 弹出框显隐时触发
|
|
67
|
+
* @event {(value: Date |string | undefined) => void} change 日期时间输入组件值改变时触发
|
|
68
|
+
*/
|
|
44
69
|
export default _defineComponent({
|
|
45
70
|
components: {
|
|
46
71
|
SarPopoutInput,
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
---
|
|
2
|
+
nav: 组件
|
|
3
|
+
title: DatetimePickerPopout
|
|
4
|
+
subtitle: 日期时间弹出框
|
|
5
|
+
group: 表单组件
|
|
6
|
+
version: 1.16+
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
## 介绍
|
|
10
|
+
|
|
11
|
+
组合了日期时间、弹出框组件,实现了便捷快速的日期选择功能。
|
|
12
|
+
|
|
13
|
+
## 引入
|
|
14
|
+
|
|
15
|
+
```ts
|
|
16
|
+
import DatetimePickerPopout from 'sard-uniapp/components/datetime-picker-popout/datetime-picker-popout.vue'
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
## 代码演示
|
|
20
|
+
|
|
21
|
+
### 基础使用
|
|
22
|
+
|
|
23
|
+
使用 `v-model` 双向绑定当前值,使用 `v-model:visible` 控制弹出框显隐。
|
|
24
|
+
|
|
25
|
+
@code('${DEMO_PATH}/datetime-picker-popout/demo/Basic.vue')
|
|
26
|
+
|
|
27
|
+
### 类型
|
|
28
|
+
|
|
29
|
+
可以使用 `yMdhms`(年月日时分秒)进行任意组合,每个字母对应一列。
|
|
30
|
+
|
|
31
|
+
@code('${DEMO_PATH}/datetime-picker-popout/demo/Type.vue')
|
|
32
|
+
|
|
33
|
+
### 自定义日期时间范围
|
|
34
|
+
|
|
35
|
+
可以使用 `min` 和 `max` 属性限制可以选择的日期时间的范围。
|
|
36
|
+
|
|
37
|
+
@code('${DEMO_PATH}/datetime-picker-popout/demo/MinMax.vue')
|
|
38
|
+
|
|
39
|
+
### 过滤器
|
|
40
|
+
|
|
41
|
+
可以使用 `filter` 属性来仅展示想要的内容,只有返回真的值才会展示。
|
|
42
|
+
|
|
43
|
+
@code('${DEMO_PATH}/datetime-picker-popout/demo/Filter.vue')
|
|
44
|
+
|
|
45
|
+
### 格式化
|
|
46
|
+
|
|
47
|
+
可以使用 `formatter` 属性格式化展示的内容。
|
|
48
|
+
|
|
49
|
+
@code('${DEMO_PATH}/datetime-picker-popout/demo/Formatter.vue')
|
|
50
|
+
|
|
51
|
+
### 农历
|
|
52
|
+
|
|
53
|
+
可以设置 `calendar="lunar"` 将历法类型改为农历。农历仅用于展示,实际绑定的值还是公历。
|
|
54
|
+
|
|
55
|
+
@code('${DEMO_PATH}/datetime-picker-popout/demo/Calendar.vue')
|
|
56
|
+
|
|
57
|
+
## API
|
|
58
|
+
|
|
59
|
+
### DatetimePickerPopoutProps
|
|
60
|
+
|
|
61
|
+
继承 [`DatetimePickerProps`](./datetime-picker#DatetimePickerProps) 并有以下额外属性:
|
|
62
|
+
|
|
63
|
+
| 属性 | 描述 | 类型 | 默认值 |
|
|
64
|
+
| ----------------- | ---------------- | ---------- | ------ |
|
|
65
|
+
| popout-class | 弹窗框根元素类名 | string | - |
|
|
66
|
+
| popout-style | 弹窗框根元素样式 | StyleValue | - |
|
|
67
|
+
| visible (v-model) | 是否显示弹出框 | boolean | - |
|
|
68
|
+
| title | 弹出框标题 | string | - |
|
|
69
|
+
| validate-event | 是否触发表单验证 | boolean | true |
|
|
70
|
+
|
|
71
|
+
### DatetimePickerPopoutEmits
|
|
72
|
+
|
|
73
|
+
| 事件 | 描述 | 类型 |
|
|
74
|
+
| ------------------ | ---------------------------- | -------------------------------------------- |
|
|
75
|
+
| update:model-value | 日期时间输入组件值改变时触发 | (value: Date \| string \| undefined) => void |
|
|
76
|
+
| change | 日期时间输入组件值改变时触发 | (value: Date \|string \| undefined) => void |
|
|
77
|
+
| update:visible | 弹出框显隐时触发 | (visible: boolean) => void |
|
|
@@ -40,6 +40,25 @@ import {
|
|
|
40
40
|
getMinDate
|
|
41
41
|
} from "../datetime-picker/common";
|
|
42
42
|
import { useFormPopout } from "../../use";
|
|
43
|
+
/**
|
|
44
|
+
* @property {string} rootClass 组件根元素类名,默认值:-。
|
|
45
|
+
* @property {StyleValue} rootStyle 组件根元素样式,默认值:-。
|
|
46
|
+
* @property {string [详见特殊符号](#DatetimeLetter)} type 设置每一列要展示的数据类型,每个字母对应一列,默认值:'yMd'。
|
|
47
|
+
* @property {'solar' | 'lunar'} calendar 历法类型,可选公历或农历,默认值:'solar'。
|
|
48
|
+
* @property {Date} min 可选的最小日期,默认值:十年前。
|
|
49
|
+
* @property {Date} max 可选的最大日期,默认值:十年后。
|
|
50
|
+
* @property {Date | string} modelValue 当前选中的日期,默认值:-。
|
|
51
|
+
* @property {(letter: DatetimeLetter, value: number, date: Date, index: number) => boolean} filter 选项的过滤函数,默认值:-。
|
|
52
|
+
* @property {(letter: DatetimeLetter, option: DatetimeColumnOption, date: Date, index: number) => string | void |undefined} formatter 选项的格式化函数,默认值:-。
|
|
53
|
+
* @property {string [详见特殊符号](../guide/date#日期格式特殊符号)} valueFormat 绑定值的格式,不指定则绑定值为 Date 对象,默认值:-。
|
|
54
|
+
* @property {string} popoutClass 弹窗框根元素类名,默认值:-。
|
|
55
|
+
* @property {StyleValue} popoutStyle 弹窗框根元素样式,默认值:-。
|
|
56
|
+
* @property {boolean} visible 是否显示弹出框,默认值:-。
|
|
57
|
+
* @property {string} title 弹出框标题,默认值:-。
|
|
58
|
+
* @property {boolean} validateEvent 是否触发表单验证,默认值:true。
|
|
59
|
+
* @event {(visible: boolean) => void} update 弹出框显隐时触发
|
|
60
|
+
* @event {(value: Date |string | undefined) => void} change 日期时间输入组件值改变时触发
|
|
61
|
+
*/
|
|
43
62
|
export default _defineComponent({
|
|
44
63
|
components: {
|
|
45
64
|
SarPopout,
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
---
|
|
2
|
+
nav: 组件
|
|
3
|
+
title: DatetimeRangePicker
|
|
4
|
+
subtitle: 日期时间范围选择器
|
|
5
|
+
group: 表单组件
|
|
6
|
+
version: 1.11+
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
## 介绍
|
|
10
|
+
|
|
11
|
+
用于选择日期时间范围。
|
|
12
|
+
|
|
13
|
+
## 引入
|
|
14
|
+
|
|
15
|
+
```ts
|
|
16
|
+
import DatetimeRangePicker from 'sard-uniapp/components/datetime-range-picker/datetime-range-picker.vue'
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
## 代码演示
|
|
20
|
+
|
|
21
|
+
### 基础使用
|
|
22
|
+
|
|
23
|
+
和 `DatetimePicker` 组件用法类似,多了一个 `tabs` 属性设置起始和结束标签页标题。
|
|
24
|
+
|
|
25
|
+
@code('${DEMO_PATH}/datetime-range-picker/demo/Basic.vue')
|
|
26
|
+
|
|
27
|
+
## API
|
|
28
|
+
|
|
29
|
+
### DatetimeRangePickerProps
|
|
30
|
+
|
|
31
|
+
继承 [`DatetimePickerProps`](./datetime-picker#DatetimePickerProps) 并有以下额外属性:
|
|
32
|
+
|
|
33
|
+
| 属性 | 描述 | 类型 | 默认值 |
|
|
34
|
+
| ----------- | ------------------------ | ------------------ | ------ |
|
|
35
|
+
| model-value | 绑定的值 | (Date \| string)[] | - |
|
|
36
|
+
| tabs | 设置起始和结束标签页标题 | string[] | - |
|
|
37
|
+
|
|
38
|
+
### DatetimeRangePickerEmits
|
|
39
|
+
|
|
40
|
+
| 事件 | 描述 | 类型 |
|
|
41
|
+
| ------------------ | -------------------- | ---------------------------------- |
|
|
42
|
+
| update:model-value | 选中的选项改变时触发 | (date: (Date \| string)[]) => void |
|
|
43
|
+
| change | 选中的选项改变时触发 | (date: (Date \| string)[]) => void |
|
|
44
|
+
|
|
45
|
+
## 主题定制
|
|
46
|
+
|
|
47
|
+
### CSS 变量
|
|
48
|
+
|
|
49
|
+
@code('./variables.scss#variables')
|
|
@@ -51,6 +51,21 @@ import {
|
|
|
51
51
|
getMaxDate,
|
|
52
52
|
getMinDate
|
|
53
53
|
} from "../datetime-picker/common";
|
|
54
|
+
/**
|
|
55
|
+
* @property {string} rootClass 组件根元素类名,默认值:-。
|
|
56
|
+
* @property {StyleValue} rootStyle 组件根元素样式,默认值:-。
|
|
57
|
+
* @property {string [详见特殊符号](#DatetimeLetter)} type 设置每一列要展示的数据类型,每个字母对应一列,默认值:'yMd'。
|
|
58
|
+
* @property {'solar' | 'lunar'} calendar 历法类型,可选公历或农历,默认值:'solar'。
|
|
59
|
+
* @property {Date} min 可选的最小日期,默认值:十年前。
|
|
60
|
+
* @property {Date} max 可选的最大日期,默认值:十年后。
|
|
61
|
+
* @property {(Date | string)[]} modelValue 绑定的值,默认值:-。
|
|
62
|
+
* @property {(letter: DatetimeLetter, value: number, date: Date, index: number) => boolean} filter 选项的过滤函数,默认值:-。
|
|
63
|
+
* @property {(letter: DatetimeLetter, option: DatetimeColumnOption, date: Date, index: number) => string | void |undefined} formatter 选项的格式化函数,默认值:-。
|
|
64
|
+
* @property {string [详见特殊符号](../guide/date#日期格式特殊符号)} valueFormat 绑定值的格式,不指定则绑定值为 Date 对象,默认值:-。
|
|
65
|
+
* @property {string[]} tabs 设置起始和结束标签页标题,默认值:-。
|
|
66
|
+
* @event {(date: (Date | string)[]) => void} update 选中的选项改变时触发
|
|
67
|
+
* @event {(date: (Date | string)[]) => void} change 选中的选项改变时触发
|
|
68
|
+
*/
|
|
54
69
|
export default _defineComponent({
|
|
55
70
|
components: {
|
|
56
71
|
SarDatetimePicker,
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
---
|
|
2
|
+
nav: 组件
|
|
3
|
+
title: DatetimeRangePickerInput
|
|
4
|
+
subtitle: 日期时间范围输入框
|
|
5
|
+
group: 表单组件
|
|
6
|
+
version: 1.11+
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
## 介绍
|
|
10
|
+
|
|
11
|
+
组合了日期时间范围弹出框、输入框组件,实现了便捷快速的日期时间范围选择功能。
|
|
12
|
+
|
|
13
|
+
## 引入
|
|
14
|
+
|
|
15
|
+
```ts
|
|
16
|
+
import DatetimeRangePickerInput from 'sard-uniapp/components/datetime-range-picker-input/datetime-range-picker-input.vue'
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
## 代码演示
|
|
20
|
+
|
|
21
|
+
### 基础使用
|
|
22
|
+
|
|
23
|
+
和 `DatetimePickerInput` 组件用法类似,多了一个 `tabs` 属性设置起始和结束标签页标题。
|
|
24
|
+
|
|
25
|
+
@code('${DEMO_PATH}/datetime-range-picker-input/demo/Basic.vue')
|
|
26
|
+
|
|
27
|
+
### 输入框日期格式
|
|
28
|
+
|
|
29
|
+
使用 `outlet-format` 属性自定义输入框日期展示的格式。
|
|
30
|
+
|
|
31
|
+
@code('${DEMO_PATH}/datetime-range-picker-input/demo/OutletFormat.vue')
|
|
32
|
+
|
|
33
|
+
### 绑定值的格式
|
|
34
|
+
|
|
35
|
+
默认绑定的值为 `Date` 实例,提交到后端时需要手动转换为特定格式的字符串;使用 `value-format` 属性可以将这个转换交由组件库处理。
|
|
36
|
+
|
|
37
|
+
@code('${DEMO_PATH}/datetime-range-picker-input/demo/ValueFormat.vue')
|
|
38
|
+
|
|
39
|
+
## API
|
|
40
|
+
|
|
41
|
+
### DatetimeRangePickerInputProps
|
|
42
|
+
|
|
43
|
+
继承 [`DatetimeRangePickerPopoutProps`](./datetime-range-picker-popout#DatetimeRangePickerPopoutProps) 并有以下额外属性:
|
|
44
|
+
|
|
45
|
+
| 属性 | 描述 | 类型 | 默认值 |
|
|
46
|
+
| --------------------------------- | ------------------------------------------------------------ | ----------------------------------------------------- | --------------- |
|
|
47
|
+
| root-class | 弹出式输入框根元素类名 | string | - |
|
|
48
|
+
| root-style | 弹出式输入框根元素样式 | StyleValue | - |
|
|
49
|
+
| disabled | 禁用状态 | boolean | false |
|
|
50
|
+
| readonly | 只读状态 | boolean | false |
|
|
51
|
+
| clearable | 是否显示清空按钮 | boolean | false |
|
|
52
|
+
| placeholder | 输入框占位符内容 | string | - |
|
|
53
|
+
| outlet-format | 输出到输入框的日期格式,不指定则根据 `type` 属性自动生成格式 | string [详见特殊符号](../guide/date#日期格式特殊符号) | - |
|
|
54
|
+
| value-on-clear <sup>1.19.2+</sup> | 设置点击清除按钮后的值 | () => any | () => undefined |
|
|
55
|
+
|
|
56
|
+
### DatetimeRangePickerInputEmits
|
|
57
|
+
|
|
58
|
+
继承 [`DatetimeRangePickerPopoutEmits`](./datetime-range-picker-popout#DatetimeRangePickerPopoutEmits)
|
|
@@ -42,6 +42,32 @@ import {
|
|
|
42
42
|
} from "./common";
|
|
43
43
|
import { mapTypeFormat } from "../datetime-picker-input/common";
|
|
44
44
|
import { useTranslate } from "../locale";
|
|
45
|
+
/**
|
|
46
|
+
* @property {string} rootClass 弹出式输入框根元素类名,默认值:-。
|
|
47
|
+
* @property {StyleValue} rootStyle 弹出式输入框根元素样式,默认值:-。
|
|
48
|
+
* @property {string [详见特殊符号](#DatetimeLetter)} type 设置每一列要展示的数据类型,每个字母对应一列,默认值:'yMd'。
|
|
49
|
+
* @property {'solar' | 'lunar'} calendar 历法类型,可选公历或农历,默认值:'solar'。
|
|
50
|
+
* @property {Date} min 可选的最小日期,默认值:十年前。
|
|
51
|
+
* @property {Date} max 可选的最大日期,默认值:十年后。
|
|
52
|
+
* @property {(Date | string)[]} modelValue 绑定的值,默认值:-。
|
|
53
|
+
* @property {(letter: DatetimeLetter, value: number, date: Date, index: number) => boolean} filter 选项的过滤函数,默认值:-。
|
|
54
|
+
* @property {(letter: DatetimeLetter, option: DatetimeColumnOption, date: Date, index: number) => string | void |undefined} formatter 选项的格式化函数,默认值:-。
|
|
55
|
+
* @property {string [详见特殊符号](../guide/date#日期格式特殊符号)} valueFormat 绑定值的格式,不指定则绑定值为 Date 对象,默认值:-。
|
|
56
|
+
* @property {string[]} tabs 设置起始和结束标签页标题,默认值:-。
|
|
57
|
+
* @property {string} popoutClass 弹窗框根元素类名,默认值:-。
|
|
58
|
+
* @property {StyleValue} popoutStyle 弹窗框根元素样式,默认值:-。
|
|
59
|
+
* @property {boolean} visible 是否显示弹出框,默认值:-。
|
|
60
|
+
* @property {string} title 弹出框标题,默认值:-。
|
|
61
|
+
* @property {boolean} validateEvent 是否触发表单验证,默认值:true。
|
|
62
|
+
* @property {boolean} disabled 禁用状态,默认值:false。
|
|
63
|
+
* @property {boolean} readonly 只读状态,默认值:false。
|
|
64
|
+
* @property {boolean} clearable 是否显示清空按钮,默认值:false。
|
|
65
|
+
* @property {string} placeholder 输入框占位符内容,默认值:-。
|
|
66
|
+
* @property {string [详见特殊符号](../guide/date#日期格式特殊符号)} outletFormat 输出到输入框的日期格式,不指定则根据 `type` 属性自动生成格式,默认值:-。
|
|
67
|
+
* @property {() => any} valueOnClear 设置点击清除按钮后的值,默认值:() => undefined。
|
|
68
|
+
* @event {(visible: boolean) => void} update 弹出框显隐时触发
|
|
69
|
+
* @event {(date: (Date | string)[]) => void} change 日期时间输入组件值改变时触发
|
|
70
|
+
*/
|
|
45
71
|
export default _defineComponent({
|
|
46
72
|
components: {
|
|
47
73
|
SarPopoutInput,
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
---
|
|
2
|
+
nav: 组件
|
|
3
|
+
title: DatetimeRangePickerPopout
|
|
4
|
+
subtitle: 日期时间范围弹出框
|
|
5
|
+
group: 表单组件
|
|
6
|
+
version: 1.16+
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
## 介绍
|
|
10
|
+
|
|
11
|
+
组合了日期时间范围、弹出框组件,实现了便捷快速的日期时间范围选择功能。
|
|
12
|
+
|
|
13
|
+
## 引入
|
|
14
|
+
|
|
15
|
+
```ts
|
|
16
|
+
import DatetimeRangePickerPopout from 'sard-uniapp/components/datetime-range-picker-popout/datetime-range-picker-popout.vue'
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
## 代码演示
|
|
20
|
+
|
|
21
|
+
### 基础使用
|
|
22
|
+
|
|
23
|
+
使用 `v-model` 双向绑定当前值,使用 `v-model:visible` 控制弹出框显隐。
|
|
24
|
+
|
|
25
|
+
@code('${DEMO_PATH}/datetime-range-picker-popout/demo/Basic.vue')
|
|
26
|
+
|
|
27
|
+
## API
|
|
28
|
+
|
|
29
|
+
### DatetimeRangePickerPopoutProps
|
|
30
|
+
|
|
31
|
+
继承 [`DatetimeRangePickerProps`](./datetime-range-picker#DatetimeRangePickerProps) 并有以下额外属性:
|
|
32
|
+
|
|
33
|
+
| 属性 | 描述 | 类型 | 默认值 |
|
|
34
|
+
| ----------------- | ---------------- | ---------- | ------ |
|
|
35
|
+
| popout-class | 弹窗框根元素类名 | string | - |
|
|
36
|
+
| popout-style | 弹窗框根元素样式 | StyleValue | - |
|
|
37
|
+
| visible (v-model) | 是否显示弹出框 | boolean | - |
|
|
38
|
+
| title | 弹出框标题 | string | - |
|
|
39
|
+
| validate-event | 是否触发表单验证 | boolean | true |
|
|
40
|
+
|
|
41
|
+
### DatetimeRangePickerPopoutEmits
|
|
42
|
+
|
|
43
|
+
| 事件 | 描述 | 类型 |
|
|
44
|
+
| ------------------ | ---------------------------- | ---------------------------------- |
|
|
45
|
+
| update:model-value | 日期时间输入组件值改变时触发 | (date: (Date \| string)[]) => void |
|
|
46
|
+
| change | 日期时间输入组件值改变时触发 | (date: (Date \| string)[]) => void |
|
|
47
|
+
| update:visible | 弹出框显隐时触发 | (visible: boolean) => void |
|
|
48
|
+
|
|
49
|
+
## 主题定制
|
|
50
|
+
|
|
51
|
+
### CSS 变量
|
|
52
|
+
|
|
53
|
+
@code('./variables.scss#variables')
|
|
@@ -40,6 +40,26 @@ import {
|
|
|
40
40
|
getMinDate
|
|
41
41
|
} from "../datetime-picker/common";
|
|
42
42
|
import { useFormPopout } from "../../use";
|
|
43
|
+
/**
|
|
44
|
+
* @property {string} rootClass 组件根元素类名,默认值:-。
|
|
45
|
+
* @property {StyleValue} rootStyle 组件根元素样式,默认值:-。
|
|
46
|
+
* @property {string [详见特殊符号](#DatetimeLetter)} type 设置每一列要展示的数据类型,每个字母对应一列,默认值:'yMd'。
|
|
47
|
+
* @property {'solar' | 'lunar'} calendar 历法类型,可选公历或农历,默认值:'solar'。
|
|
48
|
+
* @property {Date} min 可选的最小日期,默认值:十年前。
|
|
49
|
+
* @property {Date} max 可选的最大日期,默认值:十年后。
|
|
50
|
+
* @property {(Date | string)[]} modelValue 绑定的值,默认值:-。
|
|
51
|
+
* @property {(letter: DatetimeLetter, value: number, date: Date, index: number) => boolean} filter 选项的过滤函数,默认值:-。
|
|
52
|
+
* @property {(letter: DatetimeLetter, option: DatetimeColumnOption, date: Date, index: number) => string | void |undefined} formatter 选项的格式化函数,默认值:-。
|
|
53
|
+
* @property {string [详见特殊符号](../guide/date#日期格式特殊符号)} valueFormat 绑定值的格式,不指定则绑定值为 Date 对象,默认值:-。
|
|
54
|
+
* @property {string[]} tabs 设置起始和结束标签页标题,默认值:-。
|
|
55
|
+
* @property {string} popoutClass 弹窗框根元素类名,默认值:-。
|
|
56
|
+
* @property {StyleValue} popoutStyle 弹窗框根元素样式,默认值:-。
|
|
57
|
+
* @property {boolean} visible 是否显示弹出框,默认值:-。
|
|
58
|
+
* @property {string} title 弹出框标题,默认值:-。
|
|
59
|
+
* @property {boolean} validateEvent 是否触发表单验证,默认值:true。
|
|
60
|
+
* @event {(visible: boolean) => void} update 弹出框显隐时触发
|
|
61
|
+
* @event {(date: (Date | string)[]) => void} change 日期时间输入组件值改变时触发
|
|
62
|
+
*/
|
|
43
63
|
export default _defineComponent({
|
|
44
64
|
components: {
|
|
45
65
|
SarPopout,
|
|
@@ -0,0 +1,192 @@
|
|
|
1
|
+
---
|
|
2
|
+
nav: 组件
|
|
3
|
+
title: Dialog
|
|
4
|
+
subtitle: 对话框
|
|
5
|
+
group: 反馈组件
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
## 介绍
|
|
9
|
+
|
|
10
|
+
提示或接收用户的确认。
|
|
11
|
+
|
|
12
|
+
## 引入
|
|
13
|
+
|
|
14
|
+
```ts
|
|
15
|
+
import Dialog from 'sard-uniapp/components/dialog/dialog.vue'
|
|
16
|
+
import DialogAgent from 'sard-uniapp/components/dialog-agent/dialog-agent.vue'
|
|
17
|
+
import { dialog } from 'sard-uniapp'
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
## 代码演示
|
|
21
|
+
|
|
22
|
+
### 基础使用
|
|
23
|
+
|
|
24
|
+
先在页面放置代理组件。
|
|
25
|
+
|
|
26
|
+
```tsx
|
|
27
|
+
<sar-dialog-agent />
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
接着便可以使用 `dialog` 等方法显示对话框。
|
|
31
|
+
|
|
32
|
+
@code('${DEMO_PATH}/dialog/demo/Basic.vue')
|
|
33
|
+
|
|
34
|
+
### 异步关闭
|
|
35
|
+
|
|
36
|
+
如果 `beforeClose` 返回 `false` 或 `rejected` 状态的 `Promise` 可阻止关闭。
|
|
37
|
+
|
|
38
|
+
@code('${DEMO_PATH}/dialog/demo/AsyncClose.vue')
|
|
39
|
+
|
|
40
|
+
### 圆角按钮
|
|
41
|
+
|
|
42
|
+
`buttonType` 属性值为 `round` 可以将底部按钮显示为圆角的形式。
|
|
43
|
+
|
|
44
|
+
@code('${DEMO_PATH}/dialog/demo/Round.vue')
|
|
45
|
+
|
|
46
|
+
### 有头部的
|
|
47
|
+
|
|
48
|
+
配置 `headed` 属性让对话框显示头部,此时的对话框更像一个模态框。
|
|
49
|
+
|
|
50
|
+
@code('${DEMO_PATH}/dialog/demo/Headed.vue')
|
|
51
|
+
|
|
52
|
+
### 自定义内容
|
|
53
|
+
|
|
54
|
+
对话框里面可以放置任何内容,例如以模态的方式展示一个表单,通常要配合 `headed` 属性一起使用。
|
|
55
|
+
|
|
56
|
+
@code('${DEMO_PATH}/dialog/demo/Content.vue')
|
|
57
|
+
|
|
58
|
+
### 内容中包含弹出框
|
|
59
|
+
|
|
60
|
+
`v1.4.1` 起,对话框底层的 `Popup` 组件包裹在了 `root-portal` (小程序)和 `teleport` (H5)中,因此基于 `Popup` 的可弹出组件都可以相互嵌套使用,也可以放置在 `scroll-view` 里面。
|
|
61
|
+
|
|
62
|
+
@code('${DEMO_PATH}/dialog/demo/PopupContent.vue')
|
|
63
|
+
|
|
64
|
+
### 自定义按钮属性
|
|
65
|
+
|
|
66
|
+
使用 `cancelProps` 和 `confirmProps` 属性可以自定义取消和确定按钮组件的属性。
|
|
67
|
+
|
|
68
|
+
@code('${DEMO_PATH}/dialog/demo/ButtonProps.vue')
|
|
69
|
+
|
|
70
|
+
## API
|
|
71
|
+
|
|
72
|
+
### DialogProps
|
|
73
|
+
|
|
74
|
+
| 属性 | 描述 | 类型 | 默认值 |
|
|
75
|
+
| ------------------------------ | -------------------------------------------------------------------- | ----------------- | ------- |
|
|
76
|
+
| root-class | 对话框根元素类名 | string | - |
|
|
77
|
+
| root-style | 对话框根元素样式 | StyleValue | - |
|
|
78
|
+
| popup-class <sup>1.14.1+</sup> | 弹窗框根元素类名 | string | - |
|
|
79
|
+
| popup-style <sup>1.14.1+</sup> | 弹窗框根元素样式 | StyleValue | - |
|
|
80
|
+
| visible (v-model) | 是否可见 | boolean | false |
|
|
81
|
+
| title | 标题 | string | - |
|
|
82
|
+
| message | 文本内容 | string | - |
|
|
83
|
+
| headed | 是否显示带头部类型 | boolean | true |
|
|
84
|
+
| button-type | 按钮类型 | 'round' \| 'text' | 'round' |
|
|
85
|
+
| show-cancel | 是否显示取消按钮 | boolean | true |
|
|
86
|
+
| cancel-text | 取消按钮文案 | string | '取消' |
|
|
87
|
+
| show-confirm | 是否显示确定按钮 | boolean | true |
|
|
88
|
+
| confirm-text | 确定按钮文案 | string | '确定' |
|
|
89
|
+
| overlay-closable | 点击遮罩是否关闭 | boolean | false |
|
|
90
|
+
| before-close | 关闭前的回调,返回 `false` 或 `rejected` 状态的 `Promise` 可阻止关闭 | DialogBeforeClose | - |
|
|
91
|
+
| duration | 显隐动画时长,单位 ms | number | 300 |
|
|
92
|
+
| confirm-props <sup>1.10+</sup> | 设置确定按钮 props | ButtonProps | - |
|
|
93
|
+
| cancel-props <sup>1.10+</sup> | 设置取消按钮 props | ButtonProps | - |
|
|
94
|
+
|
|
95
|
+
#### DialogBeforeClose
|
|
96
|
+
|
|
97
|
+
- 当点击确定按钮时,`type` 为 `confirm`;
|
|
98
|
+
- 当点击取消按钮时,`type` 为 `cancel`;
|
|
99
|
+
- 当点击关闭按钮或遮罩时,`type` 为 `close`。
|
|
100
|
+
|
|
101
|
+
`loading` 表示当前哪个按钮处于异步关闭状态。
|
|
102
|
+
|
|
103
|
+
```ts
|
|
104
|
+
type DialogBeforeClose = (
|
|
105
|
+
type: 'close' | 'cancel' | 'confirm',
|
|
106
|
+
loading: {
|
|
107
|
+
readonly cancel: boolean
|
|
108
|
+
readonly confirm: boolean
|
|
109
|
+
readonly close: boolean
|
|
110
|
+
},
|
|
111
|
+
) => any | Promise<any>
|
|
112
|
+
```
|
|
113
|
+
|
|
114
|
+
### DialogSlots
|
|
115
|
+
|
|
116
|
+
| 插槽 | 描述 | 属性 |
|
|
117
|
+
| ------- | -------------- | ---- |
|
|
118
|
+
| default | 自定义默认内容 | - |
|
|
119
|
+
|
|
120
|
+
### DialogEmits
|
|
121
|
+
|
|
122
|
+
| 事件 | 描述 | 类型 |
|
|
123
|
+
| -------------------------------- | --------------------------- | ---------------------------------- |
|
|
124
|
+
| update:visible | 对话框显隐时触发 | (visible: boolean) => void |
|
|
125
|
+
| close | 点击关闭按钮或遮罩时触发 | () => void |
|
|
126
|
+
| cancel | 点击取消按钮时触发 | () => void |
|
|
127
|
+
| confirm | 点击确定按钮时触发 | () => void |
|
|
128
|
+
| visible-hook | 入场/退场动画状态改变时触发 | (name: TransitionHookName) => void |
|
|
129
|
+
| before-enter <sup>1.12+</sup> | 入场动画开始前触发 | () => void |
|
|
130
|
+
| enter <sup>1.12+</sup> | 入场动画开始时触发 | () => void |
|
|
131
|
+
| after-enter <sup>1.12+</sup> | 入场动画结束时触发 | () => void |
|
|
132
|
+
| enter-cancelled <sup>1.12+</sup> | 入场动画取消时触发 | () => void |
|
|
133
|
+
| before-leave <sup>1.12+</sup> | 退场动画开始前触发 | () => void |
|
|
134
|
+
| leave <sup>1.12+</sup> | 退场动画开始时触发 | () => void |
|
|
135
|
+
| after-leave <sup>1.12+</sup> | 退场动画结束时触发 | () => void |
|
|
136
|
+
| leave-cancelled <sup>1.12+</sup> | 退场动画取消时触发 | () => void |
|
|
137
|
+
|
|
138
|
+
### DialogAgentProps / DialogOptions
|
|
139
|
+
|
|
140
|
+
继承 [`DialogProps`](#DialogProps) 并有以下额外属性。
|
|
141
|
+
|
|
142
|
+
| 属性 | 描述 | 类型 | 默认值 |
|
|
143
|
+
| ---- | --------------- | ------ | -------- |
|
|
144
|
+
| id | 对话框组件的 id | string | 'dialog' |
|
|
145
|
+
|
|
146
|
+
### 命令式方法
|
|
147
|
+
|
|
148
|
+
| 名称 | 描述 | 类型 |
|
|
149
|
+
| ------- | ---------------------------- | ------------------------ |
|
|
150
|
+
| dialog | 显示对话框 | DialogFunction |
|
|
151
|
+
| alert | 显示警告框 | DialogSimpleShowFunction |
|
|
152
|
+
| confirm | 显示确认框 | DialogSimpleShowFunction |
|
|
153
|
+
| hide | 隐藏指定 `id` 的命令式对话框 | (id = 'dialog') => void |
|
|
154
|
+
| hideAll | 隐藏所有命令式对话框 | () => void |
|
|
155
|
+
|
|
156
|
+
### DialogFunction
|
|
157
|
+
|
|
158
|
+
```ts
|
|
159
|
+
type DialogFunction = DialogSimpleShowFunction & {
|
|
160
|
+
alert: DialogSimpleShowFunction
|
|
161
|
+
confirm: DialogSimpleShowFunction
|
|
162
|
+
hide: (id?: string) => void
|
|
163
|
+
hideAll: () => void
|
|
164
|
+
}
|
|
165
|
+
```
|
|
166
|
+
|
|
167
|
+
### DialogSimpleShowFunction
|
|
168
|
+
|
|
169
|
+
```ts
|
|
170
|
+
interface DialogSimpleShowFunction {
|
|
171
|
+
(options: DialogOptions): void
|
|
172
|
+
(title: string, options?: DialogOptions): void
|
|
173
|
+
}
|
|
174
|
+
```
|
|
175
|
+
|
|
176
|
+
### defaultDialogOptions
|
|
177
|
+
|
|
178
|
+
命令式默认值和声明式有所区别。
|
|
179
|
+
|
|
180
|
+
```ts
|
|
181
|
+
const defaultDialogOptions = {
|
|
182
|
+
headed: false,
|
|
183
|
+
buttonType: 'text',
|
|
184
|
+
showCancel: false,
|
|
185
|
+
}
|
|
186
|
+
```
|
|
187
|
+
|
|
188
|
+
## 主题定制
|
|
189
|
+
|
|
190
|
+
### CSS 变量
|
|
191
|
+
|
|
192
|
+
@code('./variables.scss#variables')
|