@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,53 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* @Author: weisheng
|
|
3
|
+
* @Date: 2024-03-15 11:36:12
|
|
4
|
+
* @LastEditTime: 2024-03-19 16:33:12
|
|
5
|
+
* @LastEditors: weisheng
|
|
6
|
+
* @Description:
|
|
7
|
+
* @FilePath: \wot-design-uni\src\uni_modules\wot-design-uni\components\wd-badge\types.ts
|
|
8
|
+
* 记得注释
|
|
9
|
+
*/
|
|
10
|
+
import type { ExtractPropTypes, PropType } from 'vue'
|
|
11
|
+
import { baseProps, makeBooleanProp, makeStringProp } from '../common/props'
|
|
12
|
+
|
|
13
|
+
export type BadgeType = 'primary' | 'success' | 'warning' | 'danger' | 'info'
|
|
14
|
+
|
|
15
|
+
export const badgeProps = {
|
|
16
|
+
...baseProps,
|
|
17
|
+
/**
|
|
18
|
+
* 显示值
|
|
19
|
+
*/
|
|
20
|
+
modelValue: {
|
|
21
|
+
type: [Number, String, null] as PropType<number | string | null>,
|
|
22
|
+
default: null,
|
|
23
|
+
},
|
|
24
|
+
/** 当数值为 0 时,是否展示徽标 */
|
|
25
|
+
showZero: makeBooleanProp(false),
|
|
26
|
+
bgColor: String,
|
|
27
|
+
/**
|
|
28
|
+
* 最大值,超过最大值会显示 '{max}+',要求 value 是 Number 类型
|
|
29
|
+
*/
|
|
30
|
+
max: Number,
|
|
31
|
+
/**
|
|
32
|
+
* 是否为红色点状标注
|
|
33
|
+
*/
|
|
34
|
+
isDot: Boolean,
|
|
35
|
+
/**
|
|
36
|
+
* 是否隐藏 badge
|
|
37
|
+
*/
|
|
38
|
+
hidden: Boolean,
|
|
39
|
+
/**
|
|
40
|
+
* badge类型,可选值primary / success / warning / danger / info
|
|
41
|
+
*/
|
|
42
|
+
type: makeStringProp<BadgeType | undefined>(undefined),
|
|
43
|
+
/**
|
|
44
|
+
* 为正时,角标向下偏移对应的像素
|
|
45
|
+
*/
|
|
46
|
+
top: Number,
|
|
47
|
+
/**
|
|
48
|
+
* 为正时,角标向左偏移对应的像素
|
|
49
|
+
*/
|
|
50
|
+
right: Number,
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
export type BadgeProps = ExtractPropTypes<typeof badgeProps>
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<view :class="['wd-badge', customClass]" :style="customStyle">
|
|
3
|
+
<slot></slot>
|
|
4
|
+
<view
|
|
5
|
+
v-if="isBadgeShow"
|
|
6
|
+
:class="[
|
|
7
|
+
'wd-badge__content',
|
|
8
|
+
'is-fixed',
|
|
9
|
+
type ? 'wd-badge__content--' + type : '',
|
|
10
|
+
isDot ? 'is-dot' : '',
|
|
11
|
+
]"
|
|
12
|
+
:style="contentStyle"
|
|
13
|
+
>
|
|
14
|
+
{{ content }}
|
|
15
|
+
</view>
|
|
16
|
+
</view>
|
|
17
|
+
</template>
|
|
18
|
+
<script lang="ts">
|
|
19
|
+
export default {
|
|
20
|
+
name: 'wd-badge',
|
|
21
|
+
options: {
|
|
22
|
+
addGlobalClass: true,
|
|
23
|
+
virtualHost: true,
|
|
24
|
+
styleIsolation: 'shared',
|
|
25
|
+
},
|
|
26
|
+
}
|
|
27
|
+
</script>
|
|
28
|
+
<script lang="ts" setup>
|
|
29
|
+
import { computed, ref, watch } from 'vue'
|
|
30
|
+
import { badgeProps } from './types'
|
|
31
|
+
|
|
32
|
+
const props = defineProps(badgeProps)
|
|
33
|
+
const content = ref<number | string | null>(null)
|
|
34
|
+
|
|
35
|
+
watch(
|
|
36
|
+
[() => props.modelValue, () => props.max, () => props.isDot],
|
|
37
|
+
() => {
|
|
38
|
+
notice()
|
|
39
|
+
},
|
|
40
|
+
{ immediate: true, deep: true },
|
|
41
|
+
)
|
|
42
|
+
|
|
43
|
+
const contentStyle = computed(() => {
|
|
44
|
+
return `background-color: ${props.bgColor};top:${props.top || 0}px;right:${props.right || 0}px`
|
|
45
|
+
})
|
|
46
|
+
|
|
47
|
+
// 是否展示徽标数字
|
|
48
|
+
const isBadgeShow = computed(() => {
|
|
49
|
+
let isBadgeShow: boolean = false
|
|
50
|
+
if (!props.hidden && (content.value || (content.value === 0 && props.showZero) || props.isDot)) {
|
|
51
|
+
isBadgeShow = true
|
|
52
|
+
}
|
|
53
|
+
return isBadgeShow
|
|
54
|
+
})
|
|
55
|
+
|
|
56
|
+
function notice() {
|
|
57
|
+
if (props.isDot) return
|
|
58
|
+
let value = props.modelValue
|
|
59
|
+
const max = props.max
|
|
60
|
+
if (value && max && typeof value === 'number' && !Number.isNaN(value) && !Number.isNaN(max)) {
|
|
61
|
+
value = max < value ? `${max}+` : value
|
|
62
|
+
}
|
|
63
|
+
content.value = value
|
|
64
|
+
}
|
|
65
|
+
</script>
|
|
66
|
+
|
|
67
|
+
<style lang="scss" scoped>
|
|
68
|
+
@import './index';
|
|
69
|
+
</style>
|
|
@@ -0,0 +1,340 @@
|
|
|
1
|
+
@import './../common/abstracts/_mixin';
|
|
2
|
+
@import './../common/abstracts/variable';
|
|
3
|
+
|
|
4
|
+
.wot-theme-dark {
|
|
5
|
+
@include b(button) {
|
|
6
|
+
@include when(info) {
|
|
7
|
+
color: $-dark-color3;
|
|
8
|
+
background: $-dark-background4;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
@include when(plain) {
|
|
12
|
+
background: transparent;
|
|
13
|
+
|
|
14
|
+
@include when(info) {
|
|
15
|
+
color: $-dark-color;
|
|
16
|
+
|
|
17
|
+
&::after {
|
|
18
|
+
border-color: $-dark-background5;
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
@include when(text) {
|
|
24
|
+
@include when(disabled) {
|
|
25
|
+
color: $-dark-color-gray;
|
|
26
|
+
background: transparent;
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
@include when(icon) {
|
|
31
|
+
color: $-dark-color;
|
|
32
|
+
|
|
33
|
+
@include when(disabled) {
|
|
34
|
+
color: $-dark-color-gray;
|
|
35
|
+
background: transparent;
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
@include b(button) {
|
|
42
|
+
position: relative;
|
|
43
|
+
box-sizing: border-box;
|
|
44
|
+
display: inline-flex;
|
|
45
|
+
align-items: center;
|
|
46
|
+
justify-content: center;
|
|
47
|
+
font-weight: normal;
|
|
48
|
+
color: $-button-normal-color;
|
|
49
|
+
-webkit-appearance: none;
|
|
50
|
+
user-select: none;
|
|
51
|
+
background: transparent;
|
|
52
|
+
border: none;
|
|
53
|
+
outline: none;
|
|
54
|
+
transition: opacity 0.2s;
|
|
55
|
+
|
|
56
|
+
&::before {
|
|
57
|
+
position: absolute;
|
|
58
|
+
top: 50%;
|
|
59
|
+
left: 50%;
|
|
60
|
+
width: 100%;
|
|
61
|
+
height: 100%;
|
|
62
|
+
content: ' ';
|
|
63
|
+
background: $-color-black;
|
|
64
|
+
border: inherit;
|
|
65
|
+
border-color: $-color-black;
|
|
66
|
+
border-radius: inherit;
|
|
67
|
+
opacity: 0;
|
|
68
|
+
transform: translate(-50%, -50%);
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
&::after {
|
|
72
|
+
border: none;
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
@include m(active) {
|
|
76
|
+
&:active::before {
|
|
77
|
+
opacity: 0.15;
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
@include when(disabled) {
|
|
82
|
+
opacity: $-button-disabled-opacity;
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
@include e(loading) {
|
|
86
|
+
margin-right: 5px;
|
|
87
|
+
animation: wd-rotate 0.8s linear infinite;
|
|
88
|
+
animation-duration: 2s;
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
@include e(loading-svg) {
|
|
92
|
+
width: 100%;
|
|
93
|
+
height: 100%;
|
|
94
|
+
background-repeat: no-repeat;
|
|
95
|
+
background-size: cover;
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
@include when(loading) {
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
@include when(primary) {
|
|
102
|
+
color: $-button-primary-color;
|
|
103
|
+
background: $-button-primary-bg-color;
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
@include when(success) {
|
|
107
|
+
color: $-button-success-color;
|
|
108
|
+
background: $-button-success-bg-color;
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
@include when(info) {
|
|
112
|
+
color: $-button-info-color;
|
|
113
|
+
background: $-button-info-bg-color;
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
@include when(warning) {
|
|
117
|
+
color: $-button-warning-color;
|
|
118
|
+
background: $-button-warning-bg-color;
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
@include when(error) {
|
|
122
|
+
color: $-button-error-color;
|
|
123
|
+
background: $-button-error-bg-color;
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
@include when(small) {
|
|
127
|
+
height: $-button-small-height;
|
|
128
|
+
padding: $-button-small-padding;
|
|
129
|
+
font-size: $-button-small-fs;
|
|
130
|
+
font-weight: normal;
|
|
131
|
+
border-radius: $-button-small-radius;
|
|
132
|
+
|
|
133
|
+
.wd-button__loading {
|
|
134
|
+
width: $-button-small-loading;
|
|
135
|
+
height: $-button-small-loading;
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
@include when(medium) {
|
|
140
|
+
height: $-button-medium-height;
|
|
141
|
+
padding: $-button-medium-padding;
|
|
142
|
+
font-size: $-button-medium-fs;
|
|
143
|
+
border-radius: $-button-medium-radius;
|
|
144
|
+
|
|
145
|
+
@include when(primary) {
|
|
146
|
+
box-shadow: $-button-medium-box-shadow-size $-button-primary-box-shadow-color;
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
@include when(success) {
|
|
150
|
+
box-shadow: $-button-medium-box-shadow-size $-button-success-box-shadow-color;
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
@include when(warning) {
|
|
154
|
+
box-shadow: $-button-medium-box-shadow-size $-button-warning-box-shadow-color;
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
@include when(error) {
|
|
158
|
+
box-shadow: $-button-medium-box-shadow-size $-button-error-box-shadow-color;
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
@include when(plain) {
|
|
162
|
+
box-shadow: none;
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
@include when(round) {
|
|
166
|
+
min-width: 120px;
|
|
167
|
+
|
|
168
|
+
@include when(icon) {
|
|
169
|
+
min-width: 0;
|
|
170
|
+
border-radius: 50%;
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
@include when(text) {
|
|
174
|
+
min-width: 0;
|
|
175
|
+
border-radius: 0;
|
|
176
|
+
}
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
.wd-button__loading {
|
|
180
|
+
width: $-button-medium-loading;
|
|
181
|
+
height: $-button-medium-loading;
|
|
182
|
+
}
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
@include when(large) {
|
|
186
|
+
height: $-button-large-height;
|
|
187
|
+
padding: $-button-large-padding;
|
|
188
|
+
font-size: $-button-large-fs;
|
|
189
|
+
border-radius: $-button-large-radius;
|
|
190
|
+
|
|
191
|
+
&::after {
|
|
192
|
+
border-radius: $-button-large-radius;
|
|
193
|
+
}
|
|
194
|
+
|
|
195
|
+
&:not(.is-plain) {
|
|
196
|
+
@include when(primary) {
|
|
197
|
+
box-shadow: $-button-large-box-shadow-size $-button-primary-box-shadow-color;
|
|
198
|
+
}
|
|
199
|
+
|
|
200
|
+
@include when(success) {
|
|
201
|
+
box-shadow: $-button-large-box-shadow-size $-button-success-box-shadow-color;
|
|
202
|
+
}
|
|
203
|
+
|
|
204
|
+
@include when(warning) {
|
|
205
|
+
box-shadow: $-button-large-box-shadow-size $-button-warning-box-shadow-color;
|
|
206
|
+
}
|
|
207
|
+
|
|
208
|
+
@include when(error) {
|
|
209
|
+
box-shadow: $-button-large-box-shadow-size $-button-error-box-shadow-color;
|
|
210
|
+
}
|
|
211
|
+
}
|
|
212
|
+
|
|
213
|
+
.wd-button__loading {
|
|
214
|
+
width: $-button-large-loading;
|
|
215
|
+
height: $-button-large-loading;
|
|
216
|
+
}
|
|
217
|
+
}
|
|
218
|
+
|
|
219
|
+
@include when(round) {
|
|
220
|
+
overflow: hidden;
|
|
221
|
+
border-radius: 999px;
|
|
222
|
+
}
|
|
223
|
+
|
|
224
|
+
@include when(text) {
|
|
225
|
+
min-width: 0;
|
|
226
|
+
padding: 4px 0;
|
|
227
|
+
color: $-button-primary-bg-color;
|
|
228
|
+
|
|
229
|
+
&::after {
|
|
230
|
+
display: none;
|
|
231
|
+
}
|
|
232
|
+
|
|
233
|
+
&.wd-button--active {
|
|
234
|
+
opacity: $-button-text-hover-opacity;
|
|
235
|
+
|
|
236
|
+
&:active::before {
|
|
237
|
+
display: none;
|
|
238
|
+
}
|
|
239
|
+
}
|
|
240
|
+
|
|
241
|
+
@include when(disabled) {
|
|
242
|
+
color: $-button-normal-disabled-color;
|
|
243
|
+
background: transparent;
|
|
244
|
+
}
|
|
245
|
+
}
|
|
246
|
+
|
|
247
|
+
@include when(plain) {
|
|
248
|
+
background: $-button-plain-bg-color;
|
|
249
|
+
|
|
250
|
+
@include when(primary) {
|
|
251
|
+
color: $-button-primary-bg-color;
|
|
252
|
+
border: 1px solid $-button-primary-bg-color;
|
|
253
|
+
}
|
|
254
|
+
|
|
255
|
+
@include when(success) {
|
|
256
|
+
color: $-button-success-bg-color;
|
|
257
|
+
border: 1px solid $-button-success-bg-color;
|
|
258
|
+
}
|
|
259
|
+
|
|
260
|
+
@include when(info) {
|
|
261
|
+
color: $-button-info-plain-normal-color;
|
|
262
|
+
border: 1px solid $-button-info-plain-border-color;
|
|
263
|
+
}
|
|
264
|
+
|
|
265
|
+
@include when(warning) {
|
|
266
|
+
color: $-button-warning-bg-color;
|
|
267
|
+
border: 1px solid $-button-warning-bg-color;
|
|
268
|
+
}
|
|
269
|
+
|
|
270
|
+
@include when(error) {
|
|
271
|
+
color: $-button-error-bg-color;
|
|
272
|
+
border: 1px solid $-button-error-bg-color;
|
|
273
|
+
}
|
|
274
|
+
}
|
|
275
|
+
|
|
276
|
+
@include when(hairline) {
|
|
277
|
+
&.is-plain {
|
|
278
|
+
border-width: 0;
|
|
279
|
+
border-radius: 0;
|
|
280
|
+
@include halfPixelBorderSurround();
|
|
281
|
+
|
|
282
|
+
&::after {
|
|
283
|
+
border-color: inherit;
|
|
284
|
+
}
|
|
285
|
+
}
|
|
286
|
+
}
|
|
287
|
+
|
|
288
|
+
@include when(block) {
|
|
289
|
+
display: flex;
|
|
290
|
+
}
|
|
291
|
+
|
|
292
|
+
@include when(icon) {
|
|
293
|
+
width: $-button-icon-size;
|
|
294
|
+
height: $-button-icon-size;
|
|
295
|
+
padding: 0;
|
|
296
|
+
color: $-button-icon-color;
|
|
297
|
+
border-radius: 50%;
|
|
298
|
+
|
|
299
|
+
&::after {
|
|
300
|
+
display: none;
|
|
301
|
+
}
|
|
302
|
+
|
|
303
|
+
:deep(.wd-button__icon) {
|
|
304
|
+
margin-right: 0;
|
|
305
|
+
}
|
|
306
|
+
|
|
307
|
+
@include when(disabled) {
|
|
308
|
+
color: $-button-icon-disabled-color;
|
|
309
|
+
background: transparent;
|
|
310
|
+
}
|
|
311
|
+
}
|
|
312
|
+
|
|
313
|
+
@include edeep(icon) {
|
|
314
|
+
display: block;
|
|
315
|
+
margin-right: 6px;
|
|
316
|
+
font-size: $-button-icon-fs;
|
|
317
|
+
vertical-align: middle;
|
|
318
|
+
}
|
|
319
|
+
|
|
320
|
+
@include e(text) {
|
|
321
|
+
white-space: nowrap;
|
|
322
|
+
user-select: none;
|
|
323
|
+
}
|
|
324
|
+
}
|
|
325
|
+
|
|
326
|
+
// 微信2.8.0以上版本加了较高层级的默认样式,需要重置掉
|
|
327
|
+
.wd-button {
|
|
328
|
+
width: auto;
|
|
329
|
+
min-height: auto;
|
|
330
|
+
}
|
|
331
|
+
|
|
332
|
+
@keyframes wd-rotate {
|
|
333
|
+
from {
|
|
334
|
+
transform: rotate(0deg);
|
|
335
|
+
}
|
|
336
|
+
|
|
337
|
+
to {
|
|
338
|
+
transform: rotate(360deg);
|
|
339
|
+
}
|
|
340
|
+
}
|
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* @Author: weisheng
|
|
3
|
+
* @Date: 2024-03-15 11:36:12
|
|
4
|
+
* @LastEditTime: 2024-07-23 11:38:09
|
|
5
|
+
* @LastEditors: weisheng
|
|
6
|
+
* @Description:
|
|
7
|
+
* @FilePath: \wot-design-uni\src\uni_modules\wot-design-uni\components\wd-button\types.ts
|
|
8
|
+
* 记得注释
|
|
9
|
+
*/
|
|
10
|
+
import type { ExtractPropTypes } from 'vue'
|
|
11
|
+
import { baseProps, makeBooleanProp, makeStringProp } from '../common/props'
|
|
12
|
+
|
|
13
|
+
export type ButtonType =
|
|
14
|
+
| 'primary'
|
|
15
|
+
| 'success'
|
|
16
|
+
| 'info'
|
|
17
|
+
| 'warning'
|
|
18
|
+
| 'error'
|
|
19
|
+
| 'default'
|
|
20
|
+
| 'text'
|
|
21
|
+
| 'icon'
|
|
22
|
+
export type ButtonSize = 'small' | 'medium' | 'large'
|
|
23
|
+
|
|
24
|
+
export const buttonProps = {
|
|
25
|
+
...baseProps,
|
|
26
|
+
/**
|
|
27
|
+
* 幽灵按钮
|
|
28
|
+
*/
|
|
29
|
+
plain: makeBooleanProp(false),
|
|
30
|
+
/**
|
|
31
|
+
* 圆角按钮
|
|
32
|
+
*/
|
|
33
|
+
round: makeBooleanProp(true),
|
|
34
|
+
/**
|
|
35
|
+
* 禁用按钮
|
|
36
|
+
*/
|
|
37
|
+
disabled: makeBooleanProp(false),
|
|
38
|
+
/**
|
|
39
|
+
* 是否细边框
|
|
40
|
+
*/
|
|
41
|
+
hairline: makeBooleanProp(false),
|
|
42
|
+
/**
|
|
43
|
+
* 块状按钮
|
|
44
|
+
*/
|
|
45
|
+
block: makeBooleanProp(false),
|
|
46
|
+
/**
|
|
47
|
+
* 按钮类型,可选值:primary / success / info / warning / error / text / icon
|
|
48
|
+
*/
|
|
49
|
+
type: makeStringProp<ButtonType>('primary'),
|
|
50
|
+
/**
|
|
51
|
+
* 按钮尺寸,可选值:small / medium / large
|
|
52
|
+
*/
|
|
53
|
+
size: makeStringProp<ButtonSize>('medium'),
|
|
54
|
+
/**
|
|
55
|
+
* 图标类名
|
|
56
|
+
*/
|
|
57
|
+
icon: String,
|
|
58
|
+
/**
|
|
59
|
+
* 类名前缀,用于使用自定义图标,用法参考Icon组件
|
|
60
|
+
*/
|
|
61
|
+
classPrefix: makeStringProp('wd-icon'),
|
|
62
|
+
/**
|
|
63
|
+
* 加载中按钮
|
|
64
|
+
*/
|
|
65
|
+
loading: makeBooleanProp(false),
|
|
66
|
+
/**
|
|
67
|
+
* 加载图标颜色
|
|
68
|
+
*/
|
|
69
|
+
loadingColor: String,
|
|
70
|
+
/**
|
|
71
|
+
* 开放能力
|
|
72
|
+
*/
|
|
73
|
+
openType: String,
|
|
74
|
+
/**
|
|
75
|
+
* 指定是否阻止本节点的祖先节点出现点击态
|
|
76
|
+
*/
|
|
77
|
+
hoverStopPropagation: Boolean,
|
|
78
|
+
/**
|
|
79
|
+
* 指定返回用户信息的语言,zh_CN 简体中文,zh_TW 繁体中文,en 英文
|
|
80
|
+
*/
|
|
81
|
+
lang: String,
|
|
82
|
+
/**
|
|
83
|
+
* 会话来源,open-type="contact"时有效
|
|
84
|
+
*/
|
|
85
|
+
sessionFrom: String,
|
|
86
|
+
/**
|
|
87
|
+
* 会话内消息卡片标题,open-type="contact"时有效
|
|
88
|
+
*/
|
|
89
|
+
sendMessageTitle: String,
|
|
90
|
+
/**
|
|
91
|
+
* 会话内消息卡片点击跳转小程序路径,open-type="contact"时有效
|
|
92
|
+
*/
|
|
93
|
+
sendMessagePath: String,
|
|
94
|
+
/**
|
|
95
|
+
* 会话内消息卡片图片,open-type="contact"时有效
|
|
96
|
+
*/
|
|
97
|
+
sendMessageImg: String,
|
|
98
|
+
/**
|
|
99
|
+
* 打开 APP 时,向 APP 传递的参数,open-type=launchApp时有效
|
|
100
|
+
*/
|
|
101
|
+
appParameter: String,
|
|
102
|
+
/**
|
|
103
|
+
* 是否显示会话内消息卡片,设置此参数为 true,用户进入客服会话会在右下角显示"可能要发送的小程序"提示,用户点击后可以快速发送小程序消息,open-type="contact"时有效
|
|
104
|
+
*/
|
|
105
|
+
showMessageCard: Boolean,
|
|
106
|
+
/**
|
|
107
|
+
* 按钮的唯一标识,可用于设置隐私同意授权按钮的id
|
|
108
|
+
*/
|
|
109
|
+
buttonId: String,
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
export type ButtonProps = ExtractPropTypes<typeof buttonProps>
|