@tplc/wot 0.0.1
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/components/common/AbortablePromise.ts +36 -0
- package/components/common/abstracts/_config.scss +7 -0
- package/components/common/abstracts/_function.scss +76 -0
- package/components/common/abstracts/_mixin.scss +339 -0
- package/components/common/abstracts/variable.scss +1346 -0
- package/components/common/base64.ts +30 -0
- package/components/common/canvasHelper.ts +49 -0
- package/components/common/clickoutside.ts +34 -0
- package/components/common/dayjs.ts +157 -0
- package/components/common/event.ts +8 -0
- package/components/common/props.ts +51 -0
- package/components/common/util.ts +751 -0
- package/components/composables/useCell.ts +13 -0
- package/components/composables/useChildren.ts +122 -0
- package/components/composables/useCountDown.ts +138 -0
- package/components/composables/useLockScroll.ts +39 -0
- package/components/composables/useParent.ts +41 -0
- package/components/composables/usePopover.ts +193 -0
- package/components/composables/useQueue.ts +52 -0
- package/components/composables/useRaf.ts +37 -0
- package/components/composables/useTouch.ts +44 -0
- package/components/composables/useTranslate.ts +22 -0
- package/components/wd-action-sheet/index.scss +204 -0
- package/components/wd-action-sheet/types.ts +128 -0
- package/components/wd-action-sheet/wd-action-sheet.vue +174 -0
- package/components/wd-backtop/index.scss +25 -0
- package/components/wd-backtop/types.ts +37 -0
- package/components/wd-backtop/wd-backtop.vue +48 -0
- package/components/wd-badge/index.scss +59 -0
- package/components/wd-badge/types.ts +53 -0
- package/components/wd-badge/wd-badge.vue +69 -0
- package/components/wd-button/index.scss +340 -0
- package/components/wd-button/types.ts +112 -0
- package/components/wd-button/wd-button.vue +176 -0
- package/components/wd-calendar/index.scss +244 -0
- package/components/wd-calendar/types.ts +235 -0
- package/components/wd-calendar/wd-calendar.vue +456 -0
- package/components/wd-calendar-view/index.scss +9 -0
- package/components/wd-calendar-view/month/index.scss +151 -0
- package/components/wd-calendar-view/month/month.vue +391 -0
- package/components/wd-calendar-view/month/types.ts +19 -0
- package/components/wd-calendar-view/monthPanel/index.scss +89 -0
- package/components/wd-calendar-view/monthPanel/month-panel.vue +388 -0
- package/components/wd-calendar-view/monthPanel/types.ts +48 -0
- package/components/wd-calendar-view/types.ts +134 -0
- package/components/wd-calendar-view/utils.ts +451 -0
- package/components/wd-calendar-view/wd-calendar-view.vue +111 -0
- package/components/wd-calendar-view/year/index.scss +148 -0
- package/components/wd-calendar-view/year/types.ts +19 -0
- package/components/wd-calendar-view/year/year.vue +220 -0
- package/components/wd-calendar-view/yearPanel/index.scss +24 -0
- package/components/wd-calendar-view/yearPanel/types.ts +38 -0
- package/components/wd-calendar-view/yearPanel/year-panel.vue +140 -0
- package/components/wd-card/index.scss +70 -0
- package/components/wd-card/types.ts +30 -0
- package/components/wd-card/wd-card.vue +40 -0
- package/components/wd-cell/index.scss +189 -0
- package/components/wd-cell/types.ts +96 -0
- package/components/wd-cell/wd-cell.vue +135 -0
- package/components/wd-cell-group/index.scss +55 -0
- package/components/wd-cell-group/types.ts +41 -0
- package/components/wd-cell-group/wd-cell-group.vue +45 -0
- package/components/wd-checkbox/index.scss +285 -0
- package/components/wd-checkbox/types.ts +68 -0
- package/components/wd-checkbox/wd-checkbox.vue +185 -0
- package/components/wd-checkbox-group/index.scss +20 -0
- package/components/wd-checkbox-group/types.ts +59 -0
- package/components/wd-checkbox-group/wd-checkbox-group.vue +103 -0
- package/components/wd-circle/index.scss +18 -0
- package/components/wd-circle/types.ts +54 -0
- package/components/wd-circle/wd-circle.vue +318 -0
- package/components/wd-col/index.scss +19 -0
- package/components/wd-col/types.ts +15 -0
- package/components/wd-col/wd-col.vue +91 -0
- package/components/wd-col-picker/index.scss +241 -0
- package/components/wd-col-picker/types.ts +170 -0
- package/components/wd-col-picker/wd-col-picker.vue +550 -0
- package/components/wd-collapse/index.scss +55 -0
- package/components/wd-collapse/types.ts +63 -0
- package/components/wd-collapse/wd-collapse.vue +160 -0
- package/components/wd-collapse-item/index.scss +79 -0
- package/components/wd-collapse-item/types.ts +36 -0
- package/components/wd-collapse-item/wd-collapse-item.vue +182 -0
- package/components/wd-config-provider/types.ts +1023 -0
- package/components/wd-config-provider/wd-config-provider.vue +82 -0
- package/components/wd-count-down/index.scss +14 -0
- package/components/wd-count-down/types.ts +41 -0
- package/components/wd-count-down/utils.ts +52 -0
- package/components/wd-count-down/wd-count-down.vue +60 -0
- package/components/wd-count-to/index.scss +6 -0
- package/components/wd-count-to/types.ts +110 -0
- package/components/wd-count-to/wd-count-to.vue +134 -0
- package/components/wd-curtain/index.scss +80 -0
- package/components/wd-curtain/types.ts +45 -0
- package/components/wd-curtain/wd-curtain.vue +174 -0
- package/components/wd-datetime-picker/index.scss +243 -0
- package/components/wd-datetime-picker/types.ts +225 -0
- package/components/wd-datetime-picker/wd-datetime-picker.vue +827 -0
- package/components/wd-datetime-picker-view/index.scss +0 -0
- package/components/wd-datetime-picker-view/types.ts +137 -0
- package/components/wd-datetime-picker-view/wd-datetime-picker-view.vue +514 -0
- package/components/wd-divider/index.scss +32 -0
- package/components/wd-divider/types.ts +12 -0
- package/components/wd-divider/wd-divider.vue +29 -0
- package/components/wd-drop-menu/index.scss +89 -0
- package/components/wd-drop-menu/types.ts +38 -0
- package/components/wd-drop-menu/wd-drop-menu.vue +128 -0
- package/components/wd-drop-menu-item/index.scss +66 -0
- package/components/wd-drop-menu-item/types.ts +78 -0
- package/components/wd-drop-menu-item/wd-drop-menu-item.vue +230 -0
- package/components/wd-fab/index.scss +115 -0
- package/components/wd-fab/types.ts +61 -0
- package/components/wd-fab/wd-fab.vue +257 -0
- package/components/wd-form/index.scss +10 -0
- package/components/wd-form/types.ts +93 -0
- package/components/wd-form/wd-form.vue +185 -0
- package/components/wd-form-item/index.scss +17 -0
- package/components/wd-form-item/types.ts +22 -0
- package/components/wd-form-item/wd-form-item.vue +65 -0
- package/components/wd-gap/index.scss +9 -0
- package/components/wd-gap/types.ts +23 -0
- package/components/wd-gap/wd-gap.vue +39 -0
- package/components/wd-grid/index.scss +9 -0
- package/components/wd-grid/types.ts +54 -0
- package/components/wd-grid/wd-grid.vue +107 -0
- package/components/wd-grid-item/index.scss +137 -0
- package/components/wd-grid-item/types.ts +74 -0
- package/components/wd-grid-item/wd-grid-item.vue +181 -0
- package/components/wd-icon/index.scss +1222 -0
- package/components/wd-icon/types.ts +21 -0
- package/components/wd-icon/wd-icon.vue +53 -0
- package/components/wd-icon/wd-icons.ttf +0 -0
- package/components/wd-img/index.scss +19 -0
- package/components/wd-img/types.ts +53 -0
- package/components/wd-img/wd-img.vue +76 -0
- package/components/wd-img-cropper/index.scss +227 -0
- package/components/wd-img-cropper/types.ts +87 -0
- package/components/wd-img-cropper/wd-img-cropper.vue +659 -0
- package/components/wd-index-anchor/index.scss +34 -0
- package/components/wd-index-anchor/type.ts +9 -0
- package/components/wd-index-anchor/wd-index-anchor.vue +57 -0
- package/components/wd-index-bar/index.scss +39 -0
- package/components/wd-index-bar/type.ts +28 -0
- package/components/wd-index-bar/wd-index-bar.vue +158 -0
- package/components/wd-input/index.scss +326 -0
- package/components/wd-input/types.ts +182 -0
- package/components/wd-input/wd-input.vue +327 -0
- package/components/wd-input-number/index.scss +132 -0
- package/components/wd-input-number/types.ts +78 -0
- package/components/wd-input-number/wd-input-number.vue +221 -0
- package/components/wd-loading/index.scss +34 -0
- package/components/wd-loading/types.ts +31 -0
- package/components/wd-loading/wd-loading.vue +90 -0
- package/components/wd-loadmore/index.scss +39 -0
- package/components/wd-loadmore/types.ts +24 -0
- package/components/wd-loadmore/wd-loadmore.vue +53 -0
- package/components/wd-message-box/index.scss +121 -0
- package/components/wd-message-box/index.ts +95 -0
- package/components/wd-message-box/types.ts +116 -0
- package/components/wd-message-box/wd-message-box.vue +326 -0
- package/components/wd-navbar/index.scss +103 -0
- package/components/wd-navbar/types.ts +52 -0
- package/components/wd-navbar/wd-navbar.vue +142 -0
- package/components/wd-navbar-capsule/index.scss +65 -0
- package/components/wd-navbar-capsule/types.ts +0 -0
- package/components/wd-navbar-capsule/wd-navbar-capsule.vue +31 -0
- package/components/wd-notice-bar/index.scss +86 -0
- package/components/wd-notice-bar/types.ts +56 -0
- package/components/wd-notice-bar/wd-notice-bar.vue +223 -0
- package/components/wd-notify/index.scss +34 -0
- package/components/wd-notify/index.ts +59 -0
- package/components/wd-notify/types.ts +62 -0
- package/components/wd-notify/wd-notify.vue +83 -0
- package/components/wd-number-keyboard/index.scss +78 -0
- package/components/wd-number-keyboard/key/index.scss +79 -0
- package/components/wd-number-keyboard/key/index.vue +76 -0
- package/components/wd-number-keyboard/key/types.ts +11 -0
- package/components/wd-number-keyboard/types.ts +79 -0
- package/components/wd-number-keyboard/wd-number-keyboard.vue +173 -0
- package/components/wd-overlay/index.scss +17 -0
- package/components/wd-overlay/types.ts +25 -0
- package/components/wd-overlay/wd-overlay.vue +46 -0
- package/components/wd-pagination/index.scss +57 -0
- package/components/wd-pagination/types.ts +41 -0
- package/components/wd-pagination/wd-pagination.vue +121 -0
- package/components/wd-password-input/index.scss +123 -0
- package/components/wd-password-input/types.ts +48 -0
- package/components/wd-password-input/wd-password-input.vue +58 -0
- package/components/wd-picker/index.scss +216 -0
- package/components/wd-picker/types.ts +186 -0
- package/components/wd-picker/wd-picker.vue +409 -0
- package/components/wd-picker-view/index.scss +91 -0
- package/components/wd-picker-view/types.ts +162 -0
- package/components/wd-picker-view/wd-picker-view.vue +361 -0
- package/components/wd-popover/index.scss +123 -0
- package/components/wd-popover/types.ts +69 -0
- package/components/wd-popover/wd-popover.vue +216 -0
- package/components/wd-popup/index.scss +112 -0
- package/components/wd-popup/types.ts +68 -0
- package/components/wd-popup/wd-popup.vue +227 -0
- package/components/wd-progress/index.scss +62 -0
- package/components/wd-progress/types.ts +40 -0
- package/components/wd-progress/wd-progress.vue +201 -0
- package/components/wd-radio/index.scss +300 -0
- package/components/wd-radio/types.ts +42 -0
- package/components/wd-radio/wd-radio.vue +136 -0
- package/components/wd-radio-group/index.scss +23 -0
- package/components/wd-radio-group/types.ts +36 -0
- package/components/wd-radio-group/wd-radio-group.vue +54 -0
- package/components/wd-rate/index.scss +24 -0
- package/components/wd-rate/types.ts +91 -0
- package/components/wd-rate/wd-rate.vue +131 -0
- package/components/wd-resize/index.scss +26 -0
- package/components/wd-resize/types.ts +6 -0
- package/components/wd-resize/wd-resize.vue +155 -0
- package/components/wd-row/index.scss +10 -0
- package/components/wd-row/types.ts +16 -0
- package/components/wd-row/wd-row.vue +63 -0
- package/components/wd-search/index.scss +148 -0
- package/components/wd-search/types.ts +83 -0
- package/components/wd-search/wd-search.vue +237 -0
- package/components/wd-segmented/index.scss +97 -0
- package/components/wd-segmented/types.ts +68 -0
- package/components/wd-segmented/wd-segmented.vue +143 -0
- package/components/wd-select-picker/index.scss +177 -0
- package/components/wd-select-picker/types.ts +116 -0
- package/components/wd-select-picker/wd-select-picker.vue +486 -0
- package/components/wd-sidebar/index.scss +25 -0
- package/components/wd-sidebar/types.ts +28 -0
- package/components/wd-sidebar/wd-sidebar.vue +41 -0
- package/components/wd-sidebar-item/index.scss +93 -0
- package/components/wd-sidebar-item/types.ts +31 -0
- package/components/wd-sidebar-item/wd-sidebar-item.vue +114 -0
- package/components/wd-skeleton/index.scss +101 -0
- package/components/wd-skeleton/index.ts +1 -0
- package/components/wd-skeleton/types.ts +69 -0
- package/components/wd-skeleton/wd-skeleton.vue +135 -0
- package/components/wd-slider/index.scss +91 -0
- package/components/wd-slider/types.ts +104 -0
- package/components/wd-slider/wd-slider.vue +377 -0
- package/components/wd-sort-button/index.scss +86 -0
- package/components/wd-sort-button/types.ts +43 -0
- package/components/wd-sort-button/wd-sort-button.vue +76 -0
- package/components/wd-status-tip/index.scss +37 -0
- package/components/wd-status-tip/types.ts +59 -0
- package/components/wd-status-tip/wd-status-tip.vue +94 -0
- package/components/wd-step/index.scss +236 -0
- package/components/wd-step/types.ts +33 -0
- package/components/wd-step/wd-step.vue +151 -0
- package/components/wd-steps/index.scss +10 -0
- package/components/wd-steps/types.ts +59 -0
- package/components/wd-steps/wd-steps.vue +37 -0
- package/components/wd-sticky/index.scss +9 -0
- package/components/wd-sticky/types.ts +13 -0
- package/components/wd-sticky/wd-sticky.vue +190 -0
- package/components/wd-sticky-box/index.scss +6 -0
- package/components/wd-sticky-box/types.ts +20 -0
- package/components/wd-sticky-box/wd-sticky-box.vue +154 -0
- package/components/wd-swipe-action/index.scss +22 -0
- package/components/wd-swipe-action/types.ts +43 -0
- package/components/wd-swipe-action/wd-swipe-action.vue +307 -0
- package/components/wd-swiper/index.scss +23 -0
- package/components/wd-swiper/types.ts +189 -0
- package/components/wd-swiper/wd-swiper.vue +202 -0
- package/components/wd-swiper-nav/index.scss +153 -0
- package/components/wd-swiper-nav/types.ts +42 -0
- package/components/wd-swiper-nav/wd-swiper-nav.vue +37 -0
- package/components/wd-switch/index.scss +58 -0
- package/components/wd-switch/types.ts +56 -0
- package/components/wd-switch/wd-switch.vue +83 -0
- package/components/wd-tab/index.scss +8 -0
- package/components/wd-tab/types.ts +20 -0
- package/components/wd-tab/wd-tab.vue +100 -0
- package/components/wd-tabbar/index.scss +57 -0
- package/components/wd-tabbar/types.ts +88 -0
- package/components/wd-tabbar/wd-tabbar.vue +104 -0
- package/components/wd-tabbar-item/index.scss +52 -0
- package/components/wd-tabbar-item/types.ts +51 -0
- package/components/wd-tabbar-item/wd-tabbar-item.vue +101 -0
- package/components/wd-table/index.scss +132 -0
- package/components/wd-table/types.ts +69 -0
- package/components/wd-table/wd-table.vue +255 -0
- package/components/wd-table-col/index.scss +44 -0
- package/components/wd-table-col/types.ts +54 -0
- package/components/wd-table-col/wd-table-col.vue +149 -0
- package/components/wd-tabs/index.scss +280 -0
- package/components/wd-tabs/types.ts +71 -0
- package/components/wd-tabs/wd-tabs.vue +528 -0
- package/components/wd-tag/index.scss +115 -0
- package/components/wd-tag/types.ts +81 -0
- package/components/wd-tag/wd-tag.vue +154 -0
- package/components/wd-text/index.scss +34 -0
- package/components/wd-text/types.ts +98 -0
- package/components/wd-text/wd-text.vue +138 -0
- package/components/wd-textarea/index.scss +343 -0
- package/components/wd-textarea/types.ts +298 -0
- package/components/wd-textarea/wd-textarea.vue +303 -0
- package/components/wd-toast/index.scss +66 -0
- package/components/wd-toast/index.ts +109 -0
- package/components/wd-toast/types.ts +76 -0
- package/components/wd-toast/wd-toast.vue +212 -0
- package/components/wd-tooltip/index.scss +61 -0
- package/components/wd-tooltip/types.ts +102 -0
- package/components/wd-tooltip/wd-tooltip.vue +167 -0
- package/components/wd-transition/index.scss +91 -0
- package/components/wd-transition/types.ts +89 -0
- package/components/wd-transition/wd-transition.vue +221 -0
- package/components/wd-upload/index.scss +173 -0
- package/components/wd-upload/types.ts +378 -0
- package/components/wd-upload/utils.ts +152 -0
- package/components/wd-upload/wd-upload.vue +737 -0
- package/components/wd-video-preview/index.scss +34 -0
- package/components/wd-video-preview/types.ts +32 -0
- package/components/wd-video-preview/wd-video-preview.vue +76 -0
- package/components/wd-watermark/index.scss +18 -0
- package/components/wd-watermark/types.ts +82 -0
- package/components/wd-watermark/wd-watermark.vue +592 -0
- package/components/wot-design-uni/wot-design-uni.vue +14 -0
- package/global.d.ts +108 -0
- package/index.ts +30 -0
- package/locale/index.ts +41 -0
- package/locale/lang/en-US.ts +128 -0
- package/locale/lang/th-TH.ts +127 -0
- package/locale/lang/vi-VN.ts +89 -0
- package/locale/lang/zh-CN.ts +127 -0
- package/locale/lang/zh-HK.ts +84 -0
- package/locale/lang/zh-TW.ts +84 -0
- package/package.json +20 -0
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* @Author: weisheng
|
|
3
|
+
* @Date: 2022-12-14 17:33:21
|
|
4
|
+
* @LastEditTime: 2024-08-17 18:18:16
|
|
5
|
+
* @LastEditors: weisheng
|
|
6
|
+
* @Description:
|
|
7
|
+
* @FilePath: /wot-design-uni/src/uni_modules/wot-design-uni/components/wd-message-box/index.ts
|
|
8
|
+
* 记得注释
|
|
9
|
+
*/
|
|
10
|
+
import { provide, ref } from 'vue'
|
|
11
|
+
import type { Message, MessageOptions, MessageResult, MessageType } from './types'
|
|
12
|
+
import { deepMerge } from '../common/util'
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* useMessage 用到的key
|
|
16
|
+
*
|
|
17
|
+
* @internal
|
|
18
|
+
*/
|
|
19
|
+
export const messageDefaultOptionKey = '__MESSAGE_OPTION__'
|
|
20
|
+
|
|
21
|
+
// 默认模板
|
|
22
|
+
export const defaultOptions: MessageOptions = {
|
|
23
|
+
title: '',
|
|
24
|
+
showCancelButton: false,
|
|
25
|
+
show: false,
|
|
26
|
+
closeOnClickModal: true,
|
|
27
|
+
msg: '',
|
|
28
|
+
type: 'alert',
|
|
29
|
+
inputType: 'text',
|
|
30
|
+
inputValue: '',
|
|
31
|
+
inputValidate: null,
|
|
32
|
+
showErr: false,
|
|
33
|
+
zIndex: 99,
|
|
34
|
+
lazyRender: true,
|
|
35
|
+
inputError: '',
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
export function useMessage(selector: string = ''): Message {
|
|
39
|
+
const messageOption = ref<MessageOptions>(defaultOptions) // Message选项
|
|
40
|
+
const messageOptionKey = selector ? messageDefaultOptionKey + selector : messageDefaultOptionKey
|
|
41
|
+
provide(messageOptionKey, messageOption)
|
|
42
|
+
|
|
43
|
+
const createMethod = (type: MessageType) => {
|
|
44
|
+
// 优先级:options->MessageOptions->defaultOptions
|
|
45
|
+
return (options: MessageOptions | string) => {
|
|
46
|
+
const messageOptions = deepMerge(
|
|
47
|
+
{ type },
|
|
48
|
+
typeof options === 'string' ? { title: options } : options,
|
|
49
|
+
) as MessageOptions
|
|
50
|
+
if (messageOptions.type === 'confirm' || messageOptions.type === 'prompt') {
|
|
51
|
+
messageOptions.showCancelButton = true
|
|
52
|
+
} else {
|
|
53
|
+
messageOptions.showCancelButton = false
|
|
54
|
+
}
|
|
55
|
+
return show(messageOptions)
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
const show = (option: MessageOptions | string) => {
|
|
60
|
+
// 返回一个promise
|
|
61
|
+
return new Promise<MessageResult>((resolve, reject) => {
|
|
62
|
+
const options = deepMerge(
|
|
63
|
+
defaultOptions,
|
|
64
|
+
typeof option === 'string' ? { title: option } : option,
|
|
65
|
+
) as MessageOptions
|
|
66
|
+
messageOption.value = deepMerge(options, {
|
|
67
|
+
show: true,
|
|
68
|
+
onConfirm: (res: MessageResult) => {
|
|
69
|
+
resolve(res)
|
|
70
|
+
},
|
|
71
|
+
onCancel: (res: MessageResult) => {
|
|
72
|
+
reject(res)
|
|
73
|
+
},
|
|
74
|
+
}) as MessageOptions
|
|
75
|
+
})
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
// 打开Alert 弹框
|
|
79
|
+
const alert = createMethod('alert')
|
|
80
|
+
// 打开Confirm 弹框
|
|
81
|
+
const confirm = createMethod('confirm')
|
|
82
|
+
// 打开Prompt 弹框
|
|
83
|
+
const prompt = createMethod('prompt')
|
|
84
|
+
|
|
85
|
+
const close = () => {
|
|
86
|
+
messageOption.value.show = false
|
|
87
|
+
}
|
|
88
|
+
return {
|
|
89
|
+
show,
|
|
90
|
+
alert,
|
|
91
|
+
confirm,
|
|
92
|
+
prompt,
|
|
93
|
+
close,
|
|
94
|
+
}
|
|
95
|
+
}
|
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* @Author: weisheng
|
|
3
|
+
* @Date: 2024-04-08 22:34:01
|
|
4
|
+
* @LastEditTime: 2024-04-10 12:58:10
|
|
5
|
+
* @LastEditors: weisheng
|
|
6
|
+
* @Description:
|
|
7
|
+
* @FilePath: \wot-design-uni\src\uni_modules\wot-design-uni\components\wd-message-box\types.ts
|
|
8
|
+
* 记得注释
|
|
9
|
+
*/
|
|
10
|
+
import { baseProps } from '../common/props'
|
|
11
|
+
|
|
12
|
+
export type MessageType = 'alert' | 'confirm' | 'prompt'
|
|
13
|
+
|
|
14
|
+
export type MessageBeforeConfirmOption = {
|
|
15
|
+
resolve: (isPass: boolean) => void
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
export type MessageOptions = {
|
|
19
|
+
/**
|
|
20
|
+
* 标题
|
|
21
|
+
*/
|
|
22
|
+
title?: string
|
|
23
|
+
/**
|
|
24
|
+
* 是否展示取消按钮
|
|
25
|
+
*/
|
|
26
|
+
showCancelButton?: boolean
|
|
27
|
+
|
|
28
|
+
show?: boolean
|
|
29
|
+
/**
|
|
30
|
+
* 是否支持点击蒙层进行关闭,点击蒙层回调传入的action为'modal'
|
|
31
|
+
*/
|
|
32
|
+
closeOnClickModal?: boolean
|
|
33
|
+
/**
|
|
34
|
+
* 确定按钮文案
|
|
35
|
+
*/
|
|
36
|
+
confirmButtonText?: string
|
|
37
|
+
/**
|
|
38
|
+
* 取消按钮文案
|
|
39
|
+
*/
|
|
40
|
+
cancelButtonText?: string
|
|
41
|
+
/**
|
|
42
|
+
* 消息文案
|
|
43
|
+
*/
|
|
44
|
+
msg?: string
|
|
45
|
+
/**
|
|
46
|
+
* 弹框类型
|
|
47
|
+
*/
|
|
48
|
+
type?: MessageType
|
|
49
|
+
/**
|
|
50
|
+
* 当type为prompt时,输入框类型
|
|
51
|
+
*/
|
|
52
|
+
inputType?: string
|
|
53
|
+
/**
|
|
54
|
+
* 当type为prompt时,输入框初始值
|
|
55
|
+
*/
|
|
56
|
+
inputValue?: string | number
|
|
57
|
+
/**
|
|
58
|
+
* 当type为prompt时,输入框placeholder
|
|
59
|
+
*/
|
|
60
|
+
inputPlaceholder?: string
|
|
61
|
+
/**
|
|
62
|
+
* 当type为prompt时,输入框正则校验,点击确定按钮时进行校验
|
|
63
|
+
*/
|
|
64
|
+
inputPattern?: RegExp
|
|
65
|
+
/**
|
|
66
|
+
* 当type为prompt时,输入框校验函数,点击确定按钮时进行校验
|
|
67
|
+
*/
|
|
68
|
+
inputValidate?: InputValidate | null
|
|
69
|
+
/**
|
|
70
|
+
* 当type为prompt时,输入框检验不通过时的错误提示文案
|
|
71
|
+
*/
|
|
72
|
+
inputError?: string
|
|
73
|
+
/**
|
|
74
|
+
* 是否展示错误信息
|
|
75
|
+
*/
|
|
76
|
+
showErr?: boolean
|
|
77
|
+
/**
|
|
78
|
+
* 弹窗层级
|
|
79
|
+
*/
|
|
80
|
+
zIndex?: number
|
|
81
|
+
/**
|
|
82
|
+
* 弹层内容懒渲染,触发展示时才渲染内容
|
|
83
|
+
*/
|
|
84
|
+
lazyRender?: boolean
|
|
85
|
+
/**
|
|
86
|
+
* 确认前钩子
|
|
87
|
+
*/
|
|
88
|
+
beforeConfirm?: (options: MessageBeforeConfirmOption) => void
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
export type ActionType = 'confirm' | 'cancel' | 'modal'
|
|
92
|
+
|
|
93
|
+
export type InputValidate = (inputValue: string | number) => boolean
|
|
94
|
+
|
|
95
|
+
export interface MessageResult {
|
|
96
|
+
action: ActionType
|
|
97
|
+
value?: string | number
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
export interface Message {
|
|
101
|
+
// 打开Message
|
|
102
|
+
show(toastOptions: MessageOptions | string): Promise<MessageResult>
|
|
103
|
+
// 打开Alert 弹框
|
|
104
|
+
alert(toastOptions: MessageOptions | string): Promise<MessageResult>
|
|
105
|
+
// 打开Confirm 弹框
|
|
106
|
+
confirm(toastOptions: MessageOptions | string): Promise<MessageResult>
|
|
107
|
+
// 打开Prompt 弹框
|
|
108
|
+
prompt(toastOptions: MessageOptions | string): Promise<MessageResult>
|
|
109
|
+
// 关闭Message
|
|
110
|
+
close(): void
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
export const messageBoxProps = {
|
|
114
|
+
...baseProps,
|
|
115
|
+
selector: String,
|
|
116
|
+
}
|
|
@@ -0,0 +1,326 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<view>
|
|
3
|
+
<wd-popup
|
|
4
|
+
transition="zoom-in"
|
|
5
|
+
v-model="show"
|
|
6
|
+
:close-on-click-modal="closeOnClickModal"
|
|
7
|
+
:lazy-render="lazyRender"
|
|
8
|
+
custom-class="wd-message-box"
|
|
9
|
+
@click-modal="toggleModal('modal')"
|
|
10
|
+
:z-index="zIndex"
|
|
11
|
+
:duration="200"
|
|
12
|
+
>
|
|
13
|
+
<view :class="rootClass">
|
|
14
|
+
<view :class="bodyClass">
|
|
15
|
+
<view v-if="title" class="wd-message-box__title">
|
|
16
|
+
{{ title }}
|
|
17
|
+
</view>
|
|
18
|
+
<view class="wd-message-box__content">
|
|
19
|
+
<block v-if="type === 'prompt'">
|
|
20
|
+
<wd-input
|
|
21
|
+
v-model="inputValue"
|
|
22
|
+
:type="inputType"
|
|
23
|
+
size="large"
|
|
24
|
+
:placeholder="inputPlaceholder || '请输入'"
|
|
25
|
+
@input="inputValChange"
|
|
26
|
+
/>
|
|
27
|
+
<view v-if="showErr" class="wd-message-box__input-error">
|
|
28
|
+
{{ inputError || translate('inputNoValidate') }}
|
|
29
|
+
</view>
|
|
30
|
+
</block>
|
|
31
|
+
<slot>{{ msg }}</slot>
|
|
32
|
+
</view>
|
|
33
|
+
</view>
|
|
34
|
+
<view
|
|
35
|
+
:class="`wd-message-box__actions ${showCancelButton ? 'wd-message-box__flex' : 'wd-message-box__block'}`"
|
|
36
|
+
>
|
|
37
|
+
<wd-button
|
|
38
|
+
type="info"
|
|
39
|
+
block
|
|
40
|
+
v-if="showCancelButton"
|
|
41
|
+
custom-style="margin-right: 16px;"
|
|
42
|
+
@click="toggleModal('cancel')"
|
|
43
|
+
>
|
|
44
|
+
{{ cancelButtonText || translate('cancel') }}
|
|
45
|
+
</wd-button>
|
|
46
|
+
<wd-button block @click="toggleModal('confirm')">
|
|
47
|
+
{{ confirmButtonText || translate('confirm') }}
|
|
48
|
+
</wd-button>
|
|
49
|
+
</view>
|
|
50
|
+
</view>
|
|
51
|
+
</wd-popup>
|
|
52
|
+
</view>
|
|
53
|
+
</template>
|
|
54
|
+
<script lang="ts">
|
|
55
|
+
export default {
|
|
56
|
+
name: 'wd-message-box',
|
|
57
|
+
options: {
|
|
58
|
+
virtualHost: true,
|
|
59
|
+
addGlobalClass: true,
|
|
60
|
+
styleIsolation: 'shared',
|
|
61
|
+
},
|
|
62
|
+
}
|
|
63
|
+
</script>
|
|
64
|
+
|
|
65
|
+
<script lang="ts" setup>
|
|
66
|
+
import { computed, inject, ref, watch } from 'vue'
|
|
67
|
+
import {
|
|
68
|
+
messageBoxProps,
|
|
69
|
+
type InputValidate,
|
|
70
|
+
type MessageBeforeConfirmOption,
|
|
71
|
+
type MessageOptions,
|
|
72
|
+
type MessageResult,
|
|
73
|
+
type MessageType,
|
|
74
|
+
} from './types'
|
|
75
|
+
import { defaultOptions, messageDefaultOptionKey } from '../wd-message-box'
|
|
76
|
+
import { isDef, isFunction } from '../common/util'
|
|
77
|
+
import { useTranslate } from '../composables/useTranslate'
|
|
78
|
+
|
|
79
|
+
const props = defineProps(messageBoxProps)
|
|
80
|
+
|
|
81
|
+
const { translate } = useTranslate('message-box')
|
|
82
|
+
|
|
83
|
+
const rootClass = computed(() => {
|
|
84
|
+
return `wd-message-box__container ${props.customClass}`
|
|
85
|
+
})
|
|
86
|
+
|
|
87
|
+
const bodyClass = computed(() => {
|
|
88
|
+
return `wd-message-box__body ${!title.value ? 'is-no-title' : ''} ${type.value === 'prompt' ? 'is-prompt' : ''}`
|
|
89
|
+
})
|
|
90
|
+
|
|
91
|
+
const messageOptionKey = props.selector
|
|
92
|
+
? messageDefaultOptionKey + props.selector
|
|
93
|
+
: messageDefaultOptionKey
|
|
94
|
+
const messageOption = inject(messageOptionKey, ref<MessageOptions>(defaultOptions)) // message选项
|
|
95
|
+
|
|
96
|
+
/**
|
|
97
|
+
* 消息文案
|
|
98
|
+
*/
|
|
99
|
+
const msg = ref<string>('')
|
|
100
|
+
let onConfirm: ((res: MessageResult) => void) | null = null
|
|
101
|
+
let onCancel: ((res: MessageResult) => void) | null = null
|
|
102
|
+
let beforeConfirm: ((options: MessageBeforeConfirmOption) => void) | null = null
|
|
103
|
+
const show = ref<boolean>(false)
|
|
104
|
+
/**
|
|
105
|
+
* 标题
|
|
106
|
+
*/
|
|
107
|
+
const title = ref<string>('')
|
|
108
|
+
/**
|
|
109
|
+
* 是否展示取消按钮
|
|
110
|
+
*/
|
|
111
|
+
const showCancelButton = ref<boolean>(false)
|
|
112
|
+
/**
|
|
113
|
+
* 是否支持点击蒙层进行关闭,点击蒙层回调传入的action为'modal'
|
|
114
|
+
*/
|
|
115
|
+
const closeOnClickModal = ref<boolean>(true)
|
|
116
|
+
/**
|
|
117
|
+
* 确定按钮文案
|
|
118
|
+
*/
|
|
119
|
+
const confirmButtonText = ref<string>('')
|
|
120
|
+
/**
|
|
121
|
+
* 取消按钮文案
|
|
122
|
+
*/
|
|
123
|
+
const cancelButtonText = ref<string>('')
|
|
124
|
+
|
|
125
|
+
/**
|
|
126
|
+
* 弹框类型
|
|
127
|
+
*/
|
|
128
|
+
const type = ref<MessageType>('alert')
|
|
129
|
+
|
|
130
|
+
/**
|
|
131
|
+
* 当type为prompt时,输入框类型
|
|
132
|
+
*/
|
|
133
|
+
const inputType = ref<string>('text')
|
|
134
|
+
|
|
135
|
+
/**
|
|
136
|
+
* 当type为prompt时,输入框初始值
|
|
137
|
+
*/
|
|
138
|
+
const inputValue = ref<string | number>('')
|
|
139
|
+
|
|
140
|
+
/**
|
|
141
|
+
* 当type为prompt时,输入框placeholder
|
|
142
|
+
*/
|
|
143
|
+
const inputPlaceholder = ref<string>('')
|
|
144
|
+
|
|
145
|
+
/**
|
|
146
|
+
* 当type为prompt时,输入框正则校验,点击确定按钮时进行校验
|
|
147
|
+
*/
|
|
148
|
+
const inputPattern = ref<RegExp>()
|
|
149
|
+
|
|
150
|
+
/**
|
|
151
|
+
* 当type为prompt时,输入框校验函数,点击确定按钮时进行校验
|
|
152
|
+
*/
|
|
153
|
+
let inputValidate: InputValidate | null = null
|
|
154
|
+
|
|
155
|
+
/**
|
|
156
|
+
* 当type为prompt时,输入框检验不通过时的错误提示文案
|
|
157
|
+
*/
|
|
158
|
+
const inputError = ref<string>('')
|
|
159
|
+
const showErr = ref<boolean>(false)
|
|
160
|
+
/**
|
|
161
|
+
* 弹窗层级
|
|
162
|
+
*/
|
|
163
|
+
const zIndex = ref<number>(99)
|
|
164
|
+
/**
|
|
165
|
+
* 弹层内容懒渲染,触发展示时才渲染内容
|
|
166
|
+
*/
|
|
167
|
+
const lazyRender = ref<boolean>(true)
|
|
168
|
+
|
|
169
|
+
// 监听options变化展示
|
|
170
|
+
watch(
|
|
171
|
+
() => messageOption.value,
|
|
172
|
+
(newVal: MessageOptions) => {
|
|
173
|
+
reset(newVal)
|
|
174
|
+
},
|
|
175
|
+
{
|
|
176
|
+
deep: true,
|
|
177
|
+
immediate: true,
|
|
178
|
+
},
|
|
179
|
+
)
|
|
180
|
+
|
|
181
|
+
watch(
|
|
182
|
+
() => show.value,
|
|
183
|
+
(newValue) => {
|
|
184
|
+
resetErr(newValue)
|
|
185
|
+
},
|
|
186
|
+
{
|
|
187
|
+
deep: true,
|
|
188
|
+
immediate: true,
|
|
189
|
+
},
|
|
190
|
+
)
|
|
191
|
+
|
|
192
|
+
/**
|
|
193
|
+
* 点击操作
|
|
194
|
+
* @param action
|
|
195
|
+
*/
|
|
196
|
+
function toggleModal(action: 'confirm' | 'cancel' | 'modal') {
|
|
197
|
+
if (action === 'modal' && !closeOnClickModal.value) {
|
|
198
|
+
return
|
|
199
|
+
}
|
|
200
|
+
if (type.value === 'prompt' && action === 'confirm' && !validate()) {
|
|
201
|
+
return
|
|
202
|
+
}
|
|
203
|
+
switch (action) {
|
|
204
|
+
case 'confirm':
|
|
205
|
+
if (beforeConfirm) {
|
|
206
|
+
beforeConfirm({
|
|
207
|
+
resolve: (isPass) => {
|
|
208
|
+
if (isPass) {
|
|
209
|
+
handleConfirm({
|
|
210
|
+
action,
|
|
211
|
+
value: inputValue.value,
|
|
212
|
+
})
|
|
213
|
+
}
|
|
214
|
+
},
|
|
215
|
+
})
|
|
216
|
+
} else {
|
|
217
|
+
handleConfirm({
|
|
218
|
+
action,
|
|
219
|
+
value: inputValue.value,
|
|
220
|
+
})
|
|
221
|
+
}
|
|
222
|
+
break
|
|
223
|
+
case 'cancel':
|
|
224
|
+
handleCancel({
|
|
225
|
+
action,
|
|
226
|
+
})
|
|
227
|
+
break
|
|
228
|
+
default:
|
|
229
|
+
handleCancel({
|
|
230
|
+
action: 'modal',
|
|
231
|
+
})
|
|
232
|
+
break
|
|
233
|
+
}
|
|
234
|
+
}
|
|
235
|
+
|
|
236
|
+
/**
|
|
237
|
+
* 确认回调
|
|
238
|
+
* @param result
|
|
239
|
+
*/
|
|
240
|
+
function handleConfirm(result: MessageResult) {
|
|
241
|
+
show.value = false
|
|
242
|
+
if (isFunction(onConfirm)) {
|
|
243
|
+
onConfirm(result)
|
|
244
|
+
}
|
|
245
|
+
}
|
|
246
|
+
|
|
247
|
+
/**
|
|
248
|
+
* 取消回调
|
|
249
|
+
* @param result
|
|
250
|
+
*/
|
|
251
|
+
function handleCancel(result: MessageResult) {
|
|
252
|
+
show.value = false
|
|
253
|
+
if (isFunction(onCancel)) {
|
|
254
|
+
onCancel(result)
|
|
255
|
+
}
|
|
256
|
+
}
|
|
257
|
+
|
|
258
|
+
/**
|
|
259
|
+
* @description 如果存在校验规则行为,则进行判断校验是否通过规则。默认不存在校验直接铜鼓。
|
|
260
|
+
* @return {Boolean} 是否通过校验
|
|
261
|
+
*/
|
|
262
|
+
function validate() {
|
|
263
|
+
if (inputPattern.value && !inputPattern.value.test(String(inputValue.value))) {
|
|
264
|
+
showErr.value = true
|
|
265
|
+
return false
|
|
266
|
+
}
|
|
267
|
+
if (typeof inputValidate === 'function') {
|
|
268
|
+
const validateResult = inputValidate(inputValue.value)
|
|
269
|
+
if (!validateResult) {
|
|
270
|
+
showErr.value = true
|
|
271
|
+
return false
|
|
272
|
+
}
|
|
273
|
+
}
|
|
274
|
+
showErr.value = false
|
|
275
|
+
return true
|
|
276
|
+
}
|
|
277
|
+
/**
|
|
278
|
+
* @description show关闭时,销毁错误提示
|
|
279
|
+
* @param val
|
|
280
|
+
*/
|
|
281
|
+
function resetErr(val: boolean) {
|
|
282
|
+
if (val === false) {
|
|
283
|
+
showErr.value = false
|
|
284
|
+
}
|
|
285
|
+
}
|
|
286
|
+
function inputValChange({ value }: { value: string | number }) {
|
|
287
|
+
if (value === '') {
|
|
288
|
+
showErr.value = false
|
|
289
|
+
return
|
|
290
|
+
}
|
|
291
|
+
inputValue.value = value
|
|
292
|
+
}
|
|
293
|
+
|
|
294
|
+
/**
|
|
295
|
+
* 重置message选项值
|
|
296
|
+
* @param option message选项值
|
|
297
|
+
*/
|
|
298
|
+
function reset(option: MessageOptions) {
|
|
299
|
+
if (option) {
|
|
300
|
+
title.value = isDef(option.title) ? option.title : ''
|
|
301
|
+
showCancelButton.value = isDef(option.showCancelButton) ? option.showCancelButton : false
|
|
302
|
+
show.value = option.show!
|
|
303
|
+
closeOnClickModal.value = option.closeOnClickModal!
|
|
304
|
+
confirmButtonText.value = option.confirmButtonText!
|
|
305
|
+
cancelButtonText.value = option.cancelButtonText!
|
|
306
|
+
msg.value = option.msg!
|
|
307
|
+
type.value = option.type!
|
|
308
|
+
inputType.value = option.inputType!
|
|
309
|
+
inputValue.value = option.inputValue!
|
|
310
|
+
inputPlaceholder.value = option.inputPlaceholder!
|
|
311
|
+
inputPattern.value = option.inputPattern!
|
|
312
|
+
inputValidate = option.inputValidate!
|
|
313
|
+
onConfirm = (option as any).onConfirm
|
|
314
|
+
onCancel = (option as any).onCancel
|
|
315
|
+
beforeConfirm = option.beforeConfirm!
|
|
316
|
+
inputError.value = option.inputError!
|
|
317
|
+
showErr.value = option.showErr!
|
|
318
|
+
zIndex.value = option.zIndex!
|
|
319
|
+
lazyRender.value = option.lazyRender!
|
|
320
|
+
}
|
|
321
|
+
}
|
|
322
|
+
</script>
|
|
323
|
+
|
|
324
|
+
<style lang="scss" scoped>
|
|
325
|
+
@import './index.scss';
|
|
326
|
+
</style>
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
@import './../common/abstracts/_mixin';
|
|
2
|
+
@import './../common/abstracts/variable';
|
|
3
|
+
|
|
4
|
+
.wot-theme-dark {
|
|
5
|
+
@include b(navbar) {
|
|
6
|
+
background-color: $-dark-background;
|
|
7
|
+
|
|
8
|
+
@include e(title) {
|
|
9
|
+
color: $-dark-color;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
@include e(text) {
|
|
13
|
+
color: $-dark-color;
|
|
14
|
+
@include m(hover) {
|
|
15
|
+
background-color: $-dark-background3;
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
:deep(.wd-navbar__arrow) {
|
|
20
|
+
color: $-dark-color;
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
@include b(navbar) {
|
|
26
|
+
position: relative;
|
|
27
|
+
box-sizing: content-box;
|
|
28
|
+
height: $-navbar-height;
|
|
29
|
+
line-height: $-navbar-height;
|
|
30
|
+
text-align: center;
|
|
31
|
+
user-select: none;
|
|
32
|
+
background-color: $-navbar-background;
|
|
33
|
+
|
|
34
|
+
@include e(content) {
|
|
35
|
+
position: relative;
|
|
36
|
+
width: 100%;
|
|
37
|
+
height: 100%;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
@include e(title) {
|
|
41
|
+
max-width: 60%;
|
|
42
|
+
height: 100%;
|
|
43
|
+
margin: 0 auto;
|
|
44
|
+
font-size: $-navbar-title-font-size;
|
|
45
|
+
font-weight: $-navbar-title-font-weight;
|
|
46
|
+
color: $-navbar-color;
|
|
47
|
+
@include lineEllipsis();
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
@include e(text) {
|
|
51
|
+
display: inline-block;
|
|
52
|
+
color: $-navbar-desc-font-color;
|
|
53
|
+
vertical-align: middle;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
@include e(left, right, capsule) {
|
|
57
|
+
position: absolute;
|
|
58
|
+
top: 0;
|
|
59
|
+
bottom: 0;
|
|
60
|
+
display: flex;
|
|
61
|
+
align-items: center;
|
|
62
|
+
padding: 0 12px;
|
|
63
|
+
font-size: $-navbar-desc-font-size;
|
|
64
|
+
|
|
65
|
+
@include when(disabled) {
|
|
66
|
+
opacity: $-navbar-disabled-opacity;
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
@include e(left, capsule) {
|
|
71
|
+
left: 0;
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
@include e(left) {
|
|
75
|
+
@include m(hover) {
|
|
76
|
+
background-color: $-navbar-hover-color;
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
@include e(right) {
|
|
81
|
+
right: 0;
|
|
82
|
+
@include m(hover) {
|
|
83
|
+
background-color: $-navbar-hover-color;
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
@include edeep(arrow) {
|
|
88
|
+
font-size: $-navbar-arrow-size;
|
|
89
|
+
color: $-navbar-color;
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
@include when(border) {
|
|
93
|
+
@include halfPixelBorder('bottom');
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
@include when(fixed) {
|
|
97
|
+
position: fixed;
|
|
98
|
+
top: 0;
|
|
99
|
+
left: 0;
|
|
100
|
+
z-index: 500;
|
|
101
|
+
width: 100%;
|
|
102
|
+
}
|
|
103
|
+
}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import type { ExtractPropTypes } from 'vue'
|
|
2
|
+
import { baseProps, makeBooleanProp, makeNumberProp } from '../common/props'
|
|
3
|
+
|
|
4
|
+
export const navbarProps = {
|
|
5
|
+
...baseProps,
|
|
6
|
+
/**
|
|
7
|
+
* 标题文字
|
|
8
|
+
*/
|
|
9
|
+
title: String,
|
|
10
|
+
/**
|
|
11
|
+
* 左侧文案
|
|
12
|
+
*/
|
|
13
|
+
leftText: String,
|
|
14
|
+
/**
|
|
15
|
+
* 右侧文案
|
|
16
|
+
*/
|
|
17
|
+
rightText: String,
|
|
18
|
+
/**
|
|
19
|
+
* 是否显示左侧箭头
|
|
20
|
+
*/
|
|
21
|
+
leftArrow: makeBooleanProp(false),
|
|
22
|
+
/**
|
|
23
|
+
* 是否显示下边框
|
|
24
|
+
*/
|
|
25
|
+
bordered: makeBooleanProp(true),
|
|
26
|
+
/**
|
|
27
|
+
* 是否固定到顶部
|
|
28
|
+
*/
|
|
29
|
+
fixed: makeBooleanProp(false),
|
|
30
|
+
/**
|
|
31
|
+
* 固定在顶部时,是否在标签位置生成一个等高的占位元素
|
|
32
|
+
*/
|
|
33
|
+
placeholder: makeBooleanProp(false),
|
|
34
|
+
/**
|
|
35
|
+
* 导航栏 z-index
|
|
36
|
+
*/
|
|
37
|
+
zIndex: makeNumberProp(500),
|
|
38
|
+
/**
|
|
39
|
+
* 是否开启顶部安全区适配
|
|
40
|
+
*/
|
|
41
|
+
safeAreaInsetTop: makeBooleanProp(false),
|
|
42
|
+
/**
|
|
43
|
+
* 是否禁用左侧按钮,禁用时透明度降低,且无法点击
|
|
44
|
+
*/
|
|
45
|
+
leftDisabled: makeBooleanProp(false),
|
|
46
|
+
/**
|
|
47
|
+
* 是否禁用右侧按钮,禁用时透明度降低,且无法点击
|
|
48
|
+
*/
|
|
49
|
+
rightDisabled: makeBooleanProp(false),
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
export type NavbarProps = ExtractPropTypes<typeof navbarProps>
|