@bdsoft/element 1.1.13 → 1.1.14
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/index.html +13 -0
- package/index.js +6 -6
- package/package.json +19 -23
- package/src/App.vue +28 -0
- package/src/assets/css/element.scss +196 -0
- package/src/assets/css/layout.scss +215 -0
- package/src/assets/css/tailwind.scss +67 -0
- package/src/assets/images/banner.gif +0 -0
- package/src/assets/images/banner.png +0 -0
- package/src/assets/images/bg1.svg +22 -0
- package/src/assets/images/bg2.png +0 -0
- package/src/assets/images/ff.png +0 -0
- package/src/assets/images/home-file1.png +0 -0
- package/src/assets/images/ky.png +0 -0
- package/src/assets/images/menu/add.png +0 -0
- package/src/assets/images/menu/del.png +0 -0
- package/src/assets/images/menu/down.png +0 -0
- package/src/assets/images/menu/dr.png +0 -0
- package/src/assets/images/menu/edit.png +0 -0
- package/src/assets/images/menu/kx.png +0 -0
- package/src/assets/images/menu/mb.png +0 -0
- package/src/assets/images/menu/pz.png +0 -0
- package/src/assets/images/menu/save.png +0 -0
- package/src/assets/images/menu/sj.png +0 -0
- package/src/assets/images/menu/sjk.png +0 -0
- package/src/assets/images/menu/up.png +0 -0
- package/src/assets/images/po-i.png +0 -0
- package/src/assets/images/po1-i1.png +0 -0
- package/src/assets/images/po1-i2.png +0 -0
- package/src/assets/images/po1-i3.png +0 -0
- package/src/assets/images/po1-i4.png +0 -0
- package/src/assets/images/po1-i5.png +0 -0
- package/src/assets/images/po1-i6.png +0 -0
- package/src/assets/images/po1-i7.png +0 -0
- package/src/assets/images/po1-i8.png +0 -0
- package/src/assets/images/po2-i1.png +0 -0
- package/src/assets/images/po2-i2.png +0 -0
- package/src/assets/images/po3-i1.png +0 -0
- package/src/assets/images/po4-i1.png +0 -0
- package/src/assets/images/po5-i1.png +0 -0
- package/src/assets/images/po6-i1.png +0 -0
- package/src/assets/images/po6-i2.png +0 -0
- package/src/assets/images/po7-i1.png +0 -0
- package/src/assets/images/tj1.png +0 -0
- package/src/assets/images/tj2.png +0 -0
- package/src/assets/images/tj3.png +0 -0
- package/src/components/3dcloudwords/index.js +346 -0
- package/src/components/3dcloudwords/index.vue +99 -0
- package/src/components/3dcloudwords/readme.md +66 -0
- package/src/components/badge/index.js +167 -0
- package/src/components/badge/index.scss +166 -0
- package/src/components/badge/index.vue +98 -0
- package/src/components/badge/readme.md +18 -0
- package/src/components/basic/Finish.vue +107 -0
- package/src/components/basic/button.vue +19 -0
- package/src/components/basic/readme.md +7 -0
- package/src/components/button/index.vue +48 -0
- package/src/components/button/readme.md +62 -0
- package/src/components/carousel/index.vue +104 -0
- package/src/components/carousel/readme.md +12 -0
- package/src/components/chartconfig/index.vue +141 -0
- package/src/components/chartconfig/readme.md +25 -0
- package/src/components/contextMenu/hookContxtMenu.js +41 -0
- package/src/components/contextMenu/index.vue +245 -0
- package/src/components/contextMenu/readme.md +55 -0
- package/src/components/contextMenu/useElementBounding.js +40 -0
- package/src/components/countup/countUp.js +196 -0
- package/src/components/countup/index.vue +114 -0
- package/src/components/countup/readme.md +9 -0
- package/src/components/empty/assets/build.png +0 -0
- package/src/components/empty/assets/emptybg.gif +0 -0
- package/src/components/empty/assets/emptybg.png +0 -0
- package/src/components/empty/assets/emptybg2.jpg +0 -0
- package/src/components/empty/assets/emptybg3.jpg +0 -0
- package/src/components/empty/assets/wuxiao.png +0 -0
- package/src/components/empty/assets/wuxiao.webp +0 -0
- package/src/components/empty/building.vue +117 -0
- package/src/components/empty/empty.vue +120 -0
- package/src/components/empty/index.js +12 -0
- package/src/components/empty/invalid.vue +56 -0
- package/src/components/error/Error.vue +79 -0
- package/src/components/error/readme.md +20 -0
- package/src/components/form/Form.vue +84 -0
- package/src/components/form/FormItem.vue +143 -0
- package/src/components/form/data.js +52 -0
- package/src/components/form/readme.md +69 -0
- package/src/components/layout/banner.vue +412 -0
- package/src/components/layout/bar.vue +43 -0
- package/src/components/layout/layout1.vue +60 -0
- package/src/components/layout/layout2.vue +134 -0
- package/src/components/layout/layout3.vue +107 -0
- package/src/components/layout/layout4.vue +66 -0
- package/src/components/layout/nav.vue +333 -0
- package/src/components/layout/readme.md +61 -0
- package/src/components/loading/index.vue +122 -0
- package/src/components/loading/readme.md +6 -0
- package/src/components/notice/NoticeList.vue +198 -0
- package/src/components/notice/NoticeListPaging.vue +281 -0
- package/src/components/notice/NoticeView.vue +92 -0
- package/src/components/notice/readme.md +1 -0
- package/src/components/pagination/index.vue +100 -0
- package/src/components/pagination/readme.md +19 -0
- package/src/components/pagination/scroll-to.js +51 -0
- package/src/components/progress/bar.vue +72 -0
- package/src/components/progress/progress.vue +58 -0
- package/src/components/screenfull/index.js +3 -0
- package/src/components/screenfull/index.vue +65 -0
- package/src/components/screenfull/package.json +15 -0
- package/src/components/screenfull/readme.md +6 -0
- package/src/components/statisticalCount/index.vue +80 -0
- package/src/components/statisticalCount/readme.md +21 -0
- package/src/components/username/index.vue +79 -0
- package/src/components/username/readme.md +22 -0
- package/src/components/username//346/225/210/346/236/234/345/233/276.png +0 -0
- package/src/global/index.ts +6 -0
- package/src/global/register-properties.ts +10 -0
- package/src/index.js +88 -0
- package/src/utils/coms/load.jsx +10 -0
- package/src/utils/func.js +32 -0
- package/src/utils/hookDialog.js +38 -0
- package/src/utils/hookPage.js +49 -0
- package/src/utils/index.js +5 -0
- package/src/utils/lib/console.js +39 -0
- package/src/utils/lib/debounce.js +19 -0
- package/src/utils/lib/deepextend.js +51 -0
- package/src/utils/lib/deepset.js +14 -0
- package/src/utils/lib/extend.js +28 -0
- package/src/utils/lib/index.js +13 -0
- package/src/utils/lib/json.js +90 -0
- package/src/utils/lib/mergeprops.js +62 -0
- package/src/utils/lib/mitt.js +43 -0
- package/src/utils/lib/modify.js +8 -0
- package/src/utils/lib/slot.js +19 -0
- package/src/utils/lib/toarray.js +5 -0
- package/src/utils/lib/tocase.js +11 -0
- package/src/utils/lib/todate.js +10 -0
- package/src/utils/lib/toline.js +10 -0
- package/src/utils/lib/tostring.js +7 -0
- package/src/utils/lib/type.js +45 -0
- package/src/utils/lib/unique.js +6 -0
- package/src/utils/message.js +164 -0
- package/src/utils/type.js +45 -0
- package/src/xm_components/HeadSearch/hook/hookSearch.js +96 -0
- package/src/xm_components/HeadSearch/index.vue +206 -0
- package/src/xm_components/HeadSearch/readme.md +12 -0
- package/src/xm_components/HeadSearch//346/220/234/347/264/242/345/210/227/350/241/250.png +0 -0
- package/src/xm_components/Milestone/index.vue +213 -0
- package/src/xm_components/Milestone/readme.md +15 -0
- package/src/xm_components/MultiStatisticalCard/image.png +0 -0
- package/src/xm_components/MultiStatisticalCard/index.vue +114 -0
- package/src/xm_components/MultiStatisticalCard/readme.md +29 -0
- package/src/xm_components/StatisticalCard/image.png +0 -0
- package/src/xm_components/StatisticalCard/index.vue +196 -0
- package/src/xm_components/StatisticalCard/readme.md +41 -0
- package/src/xm_components/readme.md +1 -0
- package/vite.config.js +58 -0
- package/dist/BdElement.js +0 -23432
|
@@ -0,0 +1,167 @@
|
|
|
1
|
+
import { ExtractPropTypes, PropType } from 'vue'
|
|
2
|
+
|
|
3
|
+
const getPrefixCls = (suffixCls, customizePrefixCls) => {
|
|
4
|
+
if (customizePrefixCls) return customizePrefixCls
|
|
5
|
+
return suffixCls ? `bd-${suffixCls}` : 'bd'
|
|
6
|
+
}
|
|
7
|
+
export default defineComponent({
|
|
8
|
+
compatConfig: { MODE: 3 }, // 为了实现向后兼容
|
|
9
|
+
name: 'BdBadge',
|
|
10
|
+
props: {
|
|
11
|
+
count: [Object],
|
|
12
|
+
showZero: { type: Boolean, default: undefined },
|
|
13
|
+
/** Max count to show */
|
|
14
|
+
overflowCount: { type: Number, default: 99 },
|
|
15
|
+
/** whether to show red dot without number */
|
|
16
|
+
dot: { type: Boolean, default: undefined },
|
|
17
|
+
prefixCls: String,
|
|
18
|
+
scrollNumberPrefixCls: String,
|
|
19
|
+
status: { type: String },
|
|
20
|
+
size: { type: String, default: 'default' },
|
|
21
|
+
color: String,
|
|
22
|
+
text: [Object],
|
|
23
|
+
offset: [Array],
|
|
24
|
+
numberStyle: { type: Object },
|
|
25
|
+
title: String
|
|
26
|
+
},
|
|
27
|
+
slots: ['text', 'count'],
|
|
28
|
+
setup(props, { slots, attrs }) {
|
|
29
|
+
// 样式
|
|
30
|
+
const prefixCls = computed(() => getPrefixCls('badge', props.prefixCls))
|
|
31
|
+
// ================================ Misc ================================
|
|
32
|
+
const numberedDisplayCount = computed(() => {
|
|
33
|
+
return props.count > props.overflowCount ? `${props.overflowCount}+` : props.count
|
|
34
|
+
})
|
|
35
|
+
|
|
36
|
+
const hasStatus = computed(() => (props.status !== null && props.status !== undefined) || (props.color !== null && props.color !== undefined))
|
|
37
|
+
|
|
38
|
+
const showAsDot = computed(() => props.dot)
|
|
39
|
+
|
|
40
|
+
const mergedCount = computed(() => (showAsDot.value ? '' : numberedDisplayCount.value))
|
|
41
|
+
|
|
42
|
+
const isHidden = computed(() => {
|
|
43
|
+
const isEmpty = mergedCount.value === null || mergedCount.value === undefined || mergedCount.value === ''
|
|
44
|
+
return isEmpty && !showAsDot.value
|
|
45
|
+
})
|
|
46
|
+
|
|
47
|
+
// Count should be cache in case hidden change it
|
|
48
|
+
const livingCount = ref(props.count)
|
|
49
|
+
|
|
50
|
+
// We need cache count since remove motion should not change count display
|
|
51
|
+
const displayCount = ref(mergedCount.value)
|
|
52
|
+
|
|
53
|
+
// We will cache the dot status to avoid shaking on leaved motion
|
|
54
|
+
const isDotRef = ref(showAsDot.value)
|
|
55
|
+
|
|
56
|
+
watch(
|
|
57
|
+
[() => props.count, mergedCount, showAsDot],
|
|
58
|
+
() => {
|
|
59
|
+
if (!isHidden.value) {
|
|
60
|
+
livingCount.value = props.count
|
|
61
|
+
displayCount.value = mergedCount.value
|
|
62
|
+
isDotRef.value = showAsDot.value
|
|
63
|
+
}
|
|
64
|
+
},
|
|
65
|
+
{ immediate: true }
|
|
66
|
+
)
|
|
67
|
+
|
|
68
|
+
// Shared styles
|
|
69
|
+
const statusCls = computed(() => ({
|
|
70
|
+
[`${prefixCls.value}-status-dot`]: hasStatus.value,
|
|
71
|
+
[`${prefixCls.value}-status-${props.status}`]: !!props.status,
|
|
72
|
+
[`${prefixCls.value}-status-${props.color}`]: isPresetColor(props.color)
|
|
73
|
+
}))
|
|
74
|
+
|
|
75
|
+
const statusStyle = computed(() => {
|
|
76
|
+
if (props.color && !isPresetColor(props.color)) {
|
|
77
|
+
return { background: props.color }
|
|
78
|
+
} else {
|
|
79
|
+
return {}
|
|
80
|
+
}
|
|
81
|
+
})
|
|
82
|
+
|
|
83
|
+
const scrollNumberCls = computed(() => ({
|
|
84
|
+
[`${prefixCls.value}-dot`]: isDotRef.value,
|
|
85
|
+
[`${prefixCls.value}-count`]: !isDotRef.value,
|
|
86
|
+
[`${prefixCls.value}-count-sm`]: props.size === 'small',
|
|
87
|
+
[`${prefixCls.value}-multiple-words`]: !isDotRef.value && displayCount.value && displayCount.value.toString().length > 1,
|
|
88
|
+
[`${prefixCls.value}-status-${props.status}`]: !!props.status,
|
|
89
|
+
[`${prefixCls.value}-status-${props.color}`]: isPresetColor(props.color)
|
|
90
|
+
}))
|
|
91
|
+
|
|
92
|
+
return () => {
|
|
93
|
+
const { offset, title, color } = props
|
|
94
|
+
const style = attrs.style
|
|
95
|
+
const text = getPropsSlot(slots, props, 'text')
|
|
96
|
+
const pre = prefixCls.value
|
|
97
|
+
const count = livingCount.value
|
|
98
|
+
let children = flattenChildren(slots.default?.())
|
|
99
|
+
children = children.length ? children : null
|
|
100
|
+
|
|
101
|
+
const visible = !!(!isHidden.value || slots.count)
|
|
102
|
+
|
|
103
|
+
// =============================== Styles ===============================
|
|
104
|
+
const mergedStyle = (() => {
|
|
105
|
+
if (!offset) {
|
|
106
|
+
return { ...style }
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
const offsetStyle = {
|
|
110
|
+
marginTop: isNumeric(offset[1]) ? `${offset[1]}px` : offset[1]
|
|
111
|
+
}
|
|
112
|
+
// if (direction.value === 'rtl') {
|
|
113
|
+
// offsetStyle.left = `${parseInt(offset[0] as string, 10)}px`;
|
|
114
|
+
// } else {
|
|
115
|
+
// offsetStyle.right = `${-parseInt(offset[0] as string, 10)}px`;
|
|
116
|
+
// }
|
|
117
|
+
|
|
118
|
+
return {
|
|
119
|
+
...offsetStyle,
|
|
120
|
+
...style
|
|
121
|
+
}
|
|
122
|
+
})()
|
|
123
|
+
|
|
124
|
+
// =============================== Render ===============================
|
|
125
|
+
// >>> Title
|
|
126
|
+
const titleNode = title ?? (typeof count === 'string' || typeof count === 'number' ? count : undefined)
|
|
127
|
+
|
|
128
|
+
// >>> Status Text
|
|
129
|
+
const statusTextNode = visible || !text ? null : <span class={`${pre}-status-text`}>{text}</span>
|
|
130
|
+
|
|
131
|
+
// >>> Display Component
|
|
132
|
+
const displayNode =
|
|
133
|
+
typeof count === 'object' || (count === undefined && slots.count)
|
|
134
|
+
? cloneElement(
|
|
135
|
+
count ?? slots.count?.(),
|
|
136
|
+
{
|
|
137
|
+
style: mergedStyle
|
|
138
|
+
},
|
|
139
|
+
false
|
|
140
|
+
)
|
|
141
|
+
: null
|
|
142
|
+
|
|
143
|
+
const badgeClassName = classNames(
|
|
144
|
+
pre,
|
|
145
|
+
{
|
|
146
|
+
[`${pre}-status`]: hasStatus.value,
|
|
147
|
+
[`${pre}-not-a-wrapper`]: !children,
|
|
148
|
+
[`${pre}-rtl`]: direction.value === 'rtl'
|
|
149
|
+
},
|
|
150
|
+
attrs.class
|
|
151
|
+
)
|
|
152
|
+
|
|
153
|
+
// <Badge status="success" />
|
|
154
|
+
if (!children && hasStatus.value) {
|
|
155
|
+
const statusTextColor = mergedStyle.color
|
|
156
|
+
return (
|
|
157
|
+
<span {...attrs} class={badgeClassName} style={mergedStyle}>
|
|
158
|
+
<span class={statusCls.value} style={statusStyle.value} />
|
|
159
|
+
<span style={{ color: statusTextColor }} class={`${pre}-status-text`}>
|
|
160
|
+
{text}
|
|
161
|
+
</span>
|
|
162
|
+
</span>
|
|
163
|
+
)
|
|
164
|
+
}
|
|
165
|
+
}
|
|
166
|
+
}
|
|
167
|
+
})
|
|
@@ -0,0 +1,166 @@
|
|
|
1
|
+
$badge-prefix-cls: 'bd-badge';
|
|
2
|
+
$badge-status-size: 7px;
|
|
3
|
+
$success-color: #52c41a;
|
|
4
|
+
$processing-color: #1890ff;
|
|
5
|
+
$normal-color: #d9d9d9;
|
|
6
|
+
$error-color: #ff4d4f;
|
|
7
|
+
$primary-color: #1890ff;
|
|
8
|
+
$warning-color: #faad14;
|
|
9
|
+
$text-color: #000000d9;
|
|
10
|
+
$font-size-base: 14px;
|
|
11
|
+
|
|
12
|
+
.bd-badge {
|
|
13
|
+
position: relative;
|
|
14
|
+
display: inline-block;
|
|
15
|
+
line-height: 1;
|
|
16
|
+
|
|
17
|
+
&-status {
|
|
18
|
+
line-height: inherit;
|
|
19
|
+
vertical-align: baseline;
|
|
20
|
+
|
|
21
|
+
&-dot {
|
|
22
|
+
position: relative;
|
|
23
|
+
top: -1px;
|
|
24
|
+
display: inline-block;
|
|
25
|
+
width: $badge-status-size;
|
|
26
|
+
height: $badge-status-size;
|
|
27
|
+
vertical-align: middle;
|
|
28
|
+
border-radius: 50%;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
&-success {
|
|
32
|
+
background-color: $success-color;
|
|
33
|
+
&-text {
|
|
34
|
+
color: $success-color !important;
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
|
|
39
|
+
&-processing {
|
|
40
|
+
position: relative;
|
|
41
|
+
background-color: $processing-color;
|
|
42
|
+
&-text {
|
|
43
|
+
color: $processing-color !important;
|
|
44
|
+
}
|
|
45
|
+
&::after {
|
|
46
|
+
position: absolute;
|
|
47
|
+
top: -1px;
|
|
48
|
+
left: -1px;
|
|
49
|
+
width: 100%;
|
|
50
|
+
height: 100%;
|
|
51
|
+
border: 1px solid $processing-color;
|
|
52
|
+
border-radius: 50%;
|
|
53
|
+
animation: antStatusProcessing 1.2s infinite ease-in-out;
|
|
54
|
+
content: '';
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
&-default {
|
|
59
|
+
background-color: $normal-color;
|
|
60
|
+
|
|
61
|
+
}
|
|
62
|
+
&-primary {
|
|
63
|
+
background-color: $primary-color !important;
|
|
64
|
+
&-text {
|
|
65
|
+
color: $primary-color !important;
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
&-error {
|
|
69
|
+
background-color: $error-color !important;
|
|
70
|
+
&-text {
|
|
71
|
+
color: $error-color !important;
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
&-warning {
|
|
76
|
+
background-color: $warning-color;
|
|
77
|
+
&-text {
|
|
78
|
+
color: $warning-color !important;
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
&-text {
|
|
83
|
+
margin-left: 8px;
|
|
84
|
+
color: $text-color;
|
|
85
|
+
font-size: $font-size-base;
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
// &-zoom-appear,
|
|
90
|
+
// &-zoom-enter {
|
|
91
|
+
// animation: antZoomBadgeIn $animation-duration-slow $ease-out-back;
|
|
92
|
+
// animation-fill-mode: both;
|
|
93
|
+
// }
|
|
94
|
+
|
|
95
|
+
// &-zoom-leave {
|
|
96
|
+
// animation: antZoomBadgeOut $animation-duration-slow $ease-in-back;
|
|
97
|
+
// animation-fill-mode: both;
|
|
98
|
+
// }
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
@keyframes antStatusProcessing {
|
|
102
|
+
0% {
|
|
103
|
+
transform: scale(0.8);
|
|
104
|
+
opacity: 0.5;
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
100% {
|
|
108
|
+
transform: scale(2.4);
|
|
109
|
+
opacity: 0;
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
@keyframes antZoomBadgeIn {
|
|
114
|
+
0% {
|
|
115
|
+
transform: scale(0) translate(50%, -50%);
|
|
116
|
+
opacity: 0;
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
100% {
|
|
120
|
+
transform: scale(1) translate(50%, -50%);
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
@keyframes antZoomBadgeOut {
|
|
125
|
+
0% {
|
|
126
|
+
transform: scale(1) translate(50%, -50%);
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
100% {
|
|
130
|
+
transform: scale(0) translate(50%, -50%);
|
|
131
|
+
opacity: 0;
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
@keyframes antNoWrapperZoomBadgeIn {
|
|
136
|
+
0% {
|
|
137
|
+
transform: scale(0);
|
|
138
|
+
opacity: 0;
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
100% {
|
|
142
|
+
transform: scale(1);
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
@keyframes antNoWrapperZoomBadgeOut {
|
|
147
|
+
0% {
|
|
148
|
+
transform: scale(1);
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
100% {
|
|
152
|
+
transform: scale(0);
|
|
153
|
+
opacity: 0;
|
|
154
|
+
}
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
@keyframes antBadgeLoadingCircle {
|
|
158
|
+
0% {
|
|
159
|
+
transform-origin: 50%;
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
100% {
|
|
163
|
+
transform: translate(50%, -50%) rotate(360deg);
|
|
164
|
+
transform-origin: 50%;
|
|
165
|
+
}
|
|
166
|
+
}
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
<!--
|
|
2
|
+
* @FileDescription: 徽章组件
|
|
3
|
+
* @Author: 李兵泉
|
|
4
|
+
* @Date: 2021-06-08 09 时
|
|
5
|
+
* @LastEditors: 最后更新作者
|
|
6
|
+
* @LastEditTime: 最后更新时间
|
|
7
|
+
-->
|
|
8
|
+
<script setup>
|
|
9
|
+
import { ref, useAttrs, computed, watch, onMounted } from 'vue';
|
|
10
|
+
const props = defineProps({
|
|
11
|
+
count: [Object],
|
|
12
|
+
showZero: { type: Boolean, default: undefined },
|
|
13
|
+
/** Max count to show */
|
|
14
|
+
overflowCount: { type: Number, default: 99 },
|
|
15
|
+
/** whether to show red dot without number */
|
|
16
|
+
dot: { type: Boolean, default: undefined },
|
|
17
|
+
prefixCls: String,
|
|
18
|
+
scrollNumberPrefixCls: String,
|
|
19
|
+
status: { type: String, default: '' },
|
|
20
|
+
type: { type: String, default: 'default' },
|
|
21
|
+
size: { type: String, default: 'default' },
|
|
22
|
+
color: String,
|
|
23
|
+
text: [String],
|
|
24
|
+
offset: [Array],
|
|
25
|
+
numberStyle: { type: Object },
|
|
26
|
+
title: String
|
|
27
|
+
});
|
|
28
|
+
// public
|
|
29
|
+
const isString = val => typeof val === 'string';
|
|
30
|
+
const isArray = Array.isArray;
|
|
31
|
+
const isObject = val => val !== null && typeof val === 'object';
|
|
32
|
+
|
|
33
|
+
let attrs = useAttrs();
|
|
34
|
+
// 类样式返回
|
|
35
|
+
const classNames = (...args) => {
|
|
36
|
+
const classes = [];
|
|
37
|
+
for (let i = 0; i < args.length; i++) {
|
|
38
|
+
const value = args[i];
|
|
39
|
+
if (!value) continue;
|
|
40
|
+
if (isString(value)) {
|
|
41
|
+
classes.push(value);
|
|
42
|
+
} else if (isArray(value)) {
|
|
43
|
+
for (let i = 0; i < value.length; i++) {
|
|
44
|
+
const inner = classNames(value[i]);
|
|
45
|
+
if (inner) {
|
|
46
|
+
classes.push(inner);
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
} else if (isObject(value)) {
|
|
50
|
+
for (const name in value) {
|
|
51
|
+
if (value[name]) {
|
|
52
|
+
classes.push(name);
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
return classes.join(' ');
|
|
58
|
+
};
|
|
59
|
+
|
|
60
|
+
const prefixCls = ref('bd-badge');
|
|
61
|
+
const pre = prefixCls.value;
|
|
62
|
+
const numberedDisplayCount = true;
|
|
63
|
+
const hasStatus = ref(true);
|
|
64
|
+
// 容器样式
|
|
65
|
+
const badgeClassName = classNames(
|
|
66
|
+
pre,
|
|
67
|
+
{
|
|
68
|
+
[`${pre}-status`]: hasStatus.value,
|
|
69
|
+
[`${pre}-not-a-wrapper`]: true
|
|
70
|
+
},
|
|
71
|
+
attrs.class
|
|
72
|
+
);
|
|
73
|
+
const statusCls = computed(() => ({
|
|
74
|
+
[`${prefixCls.value}-status-dot`]: hasStatus.value,
|
|
75
|
+
[`${prefixCls.value}-status-${props.status || props.type}`]: !!props.type
|
|
76
|
+
}));
|
|
77
|
+
|
|
78
|
+
const statusStyle = computed(() => {
|
|
79
|
+
if (props.color) {
|
|
80
|
+
return { background: props.color };
|
|
81
|
+
} else {
|
|
82
|
+
return {};
|
|
83
|
+
}
|
|
84
|
+
});
|
|
85
|
+
const style = attrs.style;
|
|
86
|
+
</script>
|
|
87
|
+
<template>
|
|
88
|
+
<span v-bind="attrs" :class="{ badgeClassName }" :style="{ style }">
|
|
89
|
+
<span :class="statusCls" :style="{ statusStyle }" />
|
|
90
|
+
<span :class="`${pre}-status-text ${pre}-status-${type}-text`">
|
|
91
|
+
{{ text }}
|
|
92
|
+
</span>
|
|
93
|
+
</span>
|
|
94
|
+
</template>
|
|
95
|
+
|
|
96
|
+
<style lang="scss" scoped>
|
|
97
|
+
@use './index.scss';
|
|
98
|
+
</style>
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
## 圆点组件
|
|
5
|
+
|
|
6
|
+
```
|
|
7
|
+
import { BdBadge } from '@bdsoft/element';
|
|
8
|
+
<ul>
|
|
9
|
+
如果想与圆点同色 写到text里面 如果想自定义颜色 写到/BdBadge后面
|
|
10
|
+
<li><BdBadge text='默认提示点'></BdBadge>默认提示点</li>
|
|
11
|
+
<li><BdBadge type="warning"></BdBadge>警告提示点</li>
|
|
12
|
+
<li><BdBadge type="error"></BdBadge>错误提示点</li>
|
|
13
|
+
<li><BdBadge type="processing"></BdBadge>动态提示点</li>
|
|
14
|
+
<li><BdBadge type="processing"></BdBadge>动态提示点</li>
|
|
15
|
+
<li><BdBadge type="success"></BdBadge>动态提示点</li>
|
|
16
|
+
</ul>
|
|
17
|
+
```
|
|
18
|
+
text 值与原点同色,放到slot里面则是灰色
|
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
<!--
|
|
2
|
+
* @FileDescription: 完成提示 动画组件
|
|
3
|
+
* @Author: 李兵泉
|
|
4
|
+
* @Date: 2025-09-09
|
|
5
|
+
* @LastEditors: 最后更新作者
|
|
6
|
+
* @LastEditTime: 最后更新时间
|
|
7
|
+
-->
|
|
8
|
+
<template>
|
|
9
|
+
<div class='svgwarp' :style="{scale:scale}">
|
|
10
|
+
<svg width="100" height="100">
|
|
11
|
+
<!-- 圆形部分 -->
|
|
12
|
+
<circle fill="none" stroke="#68E534" stroke-width="8" cx="50" cy="50" r="45" class="circle"
|
|
13
|
+
stroke-linecap="round" transform="rotate(-23 50 50)" />
|
|
14
|
+
|
|
15
|
+
<!-- 打钩部分 -->
|
|
16
|
+
<polyline fill="none" stroke="#68E534" stroke-width="10" points="22,53 43,71 76,34" stroke-linecap="round"
|
|
17
|
+
stroke-linejoin="round" class="tick" />
|
|
18
|
+
</svg>
|
|
19
|
+
<h2 class="title">{{ text }}</h2>
|
|
20
|
+
</div>
|
|
21
|
+
</template>
|
|
22
|
+
<script setup>
|
|
23
|
+
import { ref, reactive, computed, watch, onMounted } from "vue";
|
|
24
|
+
const props = defineProps({
|
|
25
|
+
text: {
|
|
26
|
+
type: String,
|
|
27
|
+
default: '处理数据完成!'
|
|
28
|
+
},
|
|
29
|
+
scale: {
|
|
30
|
+
type: Number,
|
|
31
|
+
default: 0.5
|
|
32
|
+
},
|
|
33
|
+
})
|
|
34
|
+
</script>
|
|
35
|
+
|
|
36
|
+
<style lang="scss" scoped>
|
|
37
|
+
.svgwarp {
|
|
38
|
+
display: flex;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
svg .circle {
|
|
42
|
+
stroke-dasharray: 298;
|
|
43
|
+
/* 圆周长:2πr = 2×3.14×190 ≈ 1194 */
|
|
44
|
+
stroke-dashoffset: 298;
|
|
45
|
+
/* 初始偏移量等于周长 */
|
|
46
|
+
animation: circle 1s ease-in-out;
|
|
47
|
+
animation-fill-mode: forwards;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
svg .tick {
|
|
51
|
+
stroke-dasharray: 88;
|
|
52
|
+
/* 打钩路径总长度 */
|
|
53
|
+
stroke-dashoffset: 88;
|
|
54
|
+
/* 初始偏移量 */
|
|
55
|
+
animation: tick .8s ease-out;
|
|
56
|
+
animation-fill-mode: forwards;
|
|
57
|
+
animation-delay: .95s;
|
|
58
|
+
/* 延迟启动 */
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
.title {
|
|
62
|
+
height: 100px;
|
|
63
|
+
line-height: 100px;
|
|
64
|
+
font-size: 36px;
|
|
65
|
+
color: #333;
|
|
66
|
+
opacity: 0;
|
|
67
|
+
animation: .6s titleAn ease-in-out;
|
|
68
|
+
animation-delay: 1.2s;
|
|
69
|
+
animation-fill-mode: forwards;
|
|
70
|
+
justify-content: center;
|
|
71
|
+
align-items: center;
|
|
72
|
+
margin-left: 20px;
|
|
73
|
+
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
@keyframes titleAn {
|
|
77
|
+
from {
|
|
78
|
+
opacity: 0;
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
to {
|
|
82
|
+
opacity: 1;
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
@keyframes tick {
|
|
87
|
+
from {
|
|
88
|
+
stroke-dashoffset: 88;
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
to {
|
|
92
|
+
stroke-dashoffset: 0;
|
|
93
|
+
/* 动画结束时完全显示 */
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
@keyframes circle {
|
|
98
|
+
from {
|
|
99
|
+
stroke-dashoffset: 298;
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
to {
|
|
103
|
+
stroke-dashoffset: 597;
|
|
104
|
+
/* 动画结束时偏移量为2倍周长 */
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
</style>
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
<!--
|
|
2
|
+
* @FileDescription: 按钮处理
|
|
3
|
+
* @Author: 李兵泉
|
|
4
|
+
* @Date: 2021-06-08 09 时
|
|
5
|
+
* @LastEditors: 最后更新作者
|
|
6
|
+
* @LastEditTime: 最后更新时间
|
|
7
|
+
-->
|
|
8
|
+
<template>
|
|
9
|
+
<div>
|
|
10
|
+
<el-button type="primary" > 测试按钮</el-button>
|
|
11
|
+
</div>
|
|
12
|
+
</template>
|
|
13
|
+
<script setup>
|
|
14
|
+
import {ref ,reactive ,computed, watch,onMounted} from "vue";
|
|
15
|
+
</script>
|
|
16
|
+
|
|
17
|
+
<style lang="scss" scoped>
|
|
18
|
+
|
|
19
|
+
</style>
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
<!--
|
|
2
|
+
* @FileDescription: 按钮组件-支持每个按钮添加loading效果
|
|
3
|
+
* @Author: 李兵泉
|
|
4
|
+
* @Date: 2021-06-08 09 时
|
|
5
|
+
* @LastEditors: 最后更新作者
|
|
6
|
+
* @LastEditTime: 最后更新时间
|
|
7
|
+
-->
|
|
8
|
+
<script setup>
|
|
9
|
+
import { ref, useSlots } from 'vue'
|
|
10
|
+
//props
|
|
11
|
+
const props = defineProps({
|
|
12
|
+
onClick:{
|
|
13
|
+
type: Function,
|
|
14
|
+
required: true
|
|
15
|
+
},
|
|
16
|
+
loadingText: {
|
|
17
|
+
type: String,
|
|
18
|
+
default: '加载中...',
|
|
19
|
+
required: false
|
|
20
|
+
}
|
|
21
|
+
})
|
|
22
|
+
|
|
23
|
+
const loading = ref(false)
|
|
24
|
+
|
|
25
|
+
// 点击事件
|
|
26
|
+
const clickHandler = async (e) => {
|
|
27
|
+
|
|
28
|
+
loading.value = true
|
|
29
|
+
try {
|
|
30
|
+
await props.onClick(e)
|
|
31
|
+
} finally {
|
|
32
|
+
loading.value = false
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
const slots = useSlots()
|
|
36
|
+
</script>
|
|
37
|
+
|
|
38
|
+
<template>
|
|
39
|
+
<el-button @click="clickHandler" :loading="loading">
|
|
40
|
+
|
|
41
|
+
<template v-if="loading">
|
|
42
|
+
{{ props.loadingText }}
|
|
43
|
+
</template>
|
|
44
|
+
<template v-else>
|
|
45
|
+
<slot />
|
|
46
|
+
</template>
|
|
47
|
+
</el-button>
|
|
48
|
+
</template>
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
## 使用示例
|
|
2
|
+
|
|
3
|
+
```html
|
|
4
|
+
<!--
|
|
5
|
+
* @FileDescription: 测试
|
|
6
|
+
* @Author: 李兵泉
|
|
7
|
+
* @Date: 2021-06-08 09 时
|
|
8
|
+
* @LastEditors: 最后更新作者
|
|
9
|
+
* @LastEditTime: 最后更新时间
|
|
10
|
+
-->
|
|
11
|
+
<template>
|
|
12
|
+
<div>11111</div>
|
|
13
|
+
<!-- <BdButton @click="handler1">测试按钮</BdButton> -->
|
|
14
|
+
<BdButton type="primary" loadingText="加载中" @click="handler1"> 按钮1 </BdButton>
|
|
15
|
+
<BdButton @click="asyncFn" loadingText="保存中"> 按钮2 </BdButton>
|
|
16
|
+
<BdButton type="primary" plain @click="handler3">
|
|
17
|
+
<template #loading>
|
|
18
|
+
<div class="custom-loading">
|
|
19
|
+
<el-icon><Refresh /></el-icon>
|
|
20
|
+
</div>
|
|
21
|
+
</template>
|
|
22
|
+
按钮3
|
|
23
|
+
</BdButton>
|
|
24
|
+
</template>
|
|
25
|
+
<script setup>
|
|
26
|
+
import { ref, reactive, computed, watch, onMounted } from 'vue'
|
|
27
|
+
import { BdButton } from '@bdsoft/element'
|
|
28
|
+
|
|
29
|
+
const asyncFn = () =>
|
|
30
|
+
new Promise((resolve) => {
|
|
31
|
+
setTimeout(resolve, 3000)
|
|
32
|
+
})
|
|
33
|
+
|
|
34
|
+
const handler1 = async () => {
|
|
35
|
+
// ...
|
|
36
|
+
await asyncFn()
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
const handler3 = () => {
|
|
40
|
+
// ...
|
|
41
|
+
return asyncFn()
|
|
42
|
+
}
|
|
43
|
+
</script>
|
|
44
|
+
|
|
45
|
+
<style lang="scss" scoped>
|
|
46
|
+
.el-button .custom-loading {
|
|
47
|
+
// margin-right: 6px;
|
|
48
|
+
width: 16px;
|
|
49
|
+
height: 16px;
|
|
50
|
+
animation: loading-rotate 2s linear infinite;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
.el-button .custom-loading .circular .path {
|
|
54
|
+
animation: loading-dash 1.5s ease-in-out infinite;
|
|
55
|
+
stroke-dasharray: 90, 150;
|
|
56
|
+
stroke-dashoffset: 0;
|
|
57
|
+
stroke-width: 2;
|
|
58
|
+
stroke: var(--el-button-text-color);
|
|
59
|
+
stroke-linecap: round;
|
|
60
|
+
}
|
|
61
|
+
</style>
|
|
62
|
+
```
|