hy-app 0.1.3 → 0.1.4
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/hy-button/hy-button.vue +7 -6
- package/components/hy-button/typing.d.ts +1 -1
- package/components/hy-divider/index.scss +1 -0
- package/components/hy-float-button/hy-float-button.vue +19 -3
- package/components/hy-float-button/index.scss +0 -2
- package/components/hy-form/typing.d.ts +1 -1
- package/components/hy-image/hy-image.vue +5 -1
- package/components/hy-loading/typing.d.ts +2 -1
- package/components/hy-login/TheUserLogin.vue +5 -73
- package/components/hy-notice-bar/hy-row-notice.vue +12 -3
- package/components/hy-parse/hy-parse.vue +499 -0
- package/components/hy-parse/index.scss +9 -0
- package/components/hy-parse/node/node.vue +584 -0
- package/components/hy-parse/parser.js +1337 -0
- package/components/hy-parse/props.ts +19 -0
- package/components/hy-parse/typing.d.ts +68 -0
- package/components/hy-price/hy-price.vue +6 -8
- package/components/hy-price/index.scss +6 -6
- package/components/hy-price/props.ts +4 -3
- package/components/hy-price/typing.d.ts +8 -4
- package/components/hy-slider/hy-slider.vue +4 -3
- package/components/hy-submitBar/Index.vue +17 -0
- package/components/hy-submitBar/hy-submitBar.vue +216 -0
- package/components/hy-submitBar/index.scss +9 -0
- package/components/hy-submitBar/props.ts +22 -0
- package/components/hy-submitBar/typing.d.ts +88 -0
- package/components/hy-tag/hy-tag.vue +24 -6
- package/components/hy-tag/index.scss +3 -2
- package/components/hy-text/typing.d.ts +1 -1
- package/components/hy-toast/hy-toast.vue +175 -0
- package/components/hy-toast/index.scss +77 -0
- package/components/hy-toast/props.ts +3 -0
- package/components/hy-toast/typing.d.ts +38 -0
- package/components/hy-warn/hy-warn.vue +2 -21
- package/components/hy-waterfall/hy-waterfall.vue +168 -38
- package/components/hy-waterfall/index.scss +9 -75
- package/components/hy-waterfall/props.ts +4 -5
- package/components/hy-waterfall/typing.d.ts +5 -9
- package/composables/index.ts +1 -0
- package/composables/useShare.ts +27 -0
- package/config/color.ts +1 -1
- package/config/icon.ts +21 -1
- package/index.ts +9 -8
- package/package.json +3 -2
- package/typing/index.ts +1 -1
- package/typing/modules/common.d.ts +21 -1
- package/utils/inspect.ts +50 -1
- package/utils/utils.ts +9 -7
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import type IProps from "./typing";
|
|
2
|
+
|
|
3
|
+
const defaultProps: IProps = {
|
|
4
|
+
content: "",
|
|
5
|
+
copyLink: "",
|
|
6
|
+
domain: "",
|
|
7
|
+
errorImg: "",
|
|
8
|
+
lazyLoad: false,
|
|
9
|
+
loadingImg: "",
|
|
10
|
+
pauseVideo: true,
|
|
11
|
+
previewImg: true,
|
|
12
|
+
scrollTable: false,
|
|
13
|
+
selectable: false,
|
|
14
|
+
setTitle: true,
|
|
15
|
+
showImgMenu: true,
|
|
16
|
+
useAnchor: false,
|
|
17
|
+
};
|
|
18
|
+
|
|
19
|
+
export default defaultProps;
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
import type { CSSProperties } from "vue";
|
|
2
|
+
|
|
3
|
+
export default interface IProps {
|
|
4
|
+
/**
|
|
5
|
+
* @description 用于渲染的 html 字符串
|
|
6
|
+
* */
|
|
7
|
+
content?: string;
|
|
8
|
+
/**
|
|
9
|
+
* @description 是否允许外部链接被点击时自动复制
|
|
10
|
+
* */
|
|
11
|
+
copyLink?: string;
|
|
12
|
+
/**
|
|
13
|
+
* @description 主域名,用于拼接链接
|
|
14
|
+
* */
|
|
15
|
+
domain?: string;
|
|
16
|
+
/**
|
|
17
|
+
* @description 图片出错时的占位图链接
|
|
18
|
+
* */
|
|
19
|
+
errorImg?: string;
|
|
20
|
+
/**
|
|
21
|
+
* @description 是否开启图片懒加载
|
|
22
|
+
* */
|
|
23
|
+
lazyLoad?: boolean;
|
|
24
|
+
/**
|
|
25
|
+
* @description 图片加载过程中的占位图链接
|
|
26
|
+
* */
|
|
27
|
+
loadingImg?: string;
|
|
28
|
+
/**
|
|
29
|
+
* @description 是否在播放一个视频时自动暂停其他视频
|
|
30
|
+
* */
|
|
31
|
+
pauseVideo?: boolean;
|
|
32
|
+
/**
|
|
33
|
+
* @description 是否允许图片被点击时自动预览
|
|
34
|
+
* */
|
|
35
|
+
previewImg?: boolean;
|
|
36
|
+
/**
|
|
37
|
+
* @description 是否给每个表格添加一个滚动层使其能单独横向滚动
|
|
38
|
+
* */
|
|
39
|
+
scrollTable?: boolean;
|
|
40
|
+
/**
|
|
41
|
+
* @description 是否开启长按复制
|
|
42
|
+
* */
|
|
43
|
+
selectable?: boolean;
|
|
44
|
+
/**
|
|
45
|
+
* @description 是否将 title 标签的内容设置到页面标题
|
|
46
|
+
* */
|
|
47
|
+
setTitle?: boolean;
|
|
48
|
+
/**
|
|
49
|
+
* @description 是否允许图片被长按时显示菜单
|
|
50
|
+
* */
|
|
51
|
+
showImgMenu?: boolean;
|
|
52
|
+
/**
|
|
53
|
+
* @description 是否使用锚点链接
|
|
54
|
+
* */
|
|
55
|
+
useAnchor?: boolean;
|
|
56
|
+
/**
|
|
57
|
+
* @description 标签的默认样式
|
|
58
|
+
* */
|
|
59
|
+
tagStyle?: CSSProperties;
|
|
60
|
+
/**
|
|
61
|
+
* @description 容器的样式
|
|
62
|
+
* */
|
|
63
|
+
containerStyle?: CSSProperties;
|
|
64
|
+
/**
|
|
65
|
+
* @description 定义需要用到的外部样式
|
|
66
|
+
* */
|
|
67
|
+
customStyle?: CSSProperties;
|
|
68
|
+
}
|
|
@@ -7,9 +7,7 @@
|
|
|
7
7
|
<text class="hy-price__prefix">{{ symbol }}</text>
|
|
8
8
|
<text
|
|
9
9
|
class="hy-price__text"
|
|
10
|
-
:style="[
|
|
11
|
-
{ 'font-size': `${Number(fontSize) + Number(fontSize) * 0.8}rpx` },
|
|
12
|
-
]"
|
|
10
|
+
:style="[{ 'font-size': addUnit(getPx(size) * ratio) }]"
|
|
13
11
|
>{{ priceOne[0] }}
|
|
14
12
|
</text>
|
|
15
13
|
<text class="hy-price__decimal">
|
|
@@ -22,10 +20,10 @@
|
|
|
22
20
|
import { computed, type CSSProperties, toRefs } from "vue";
|
|
23
21
|
import defaultProps from "./props";
|
|
24
22
|
import type IProps from "./typing";
|
|
25
|
-
import { addUnit } from "../../utils";
|
|
23
|
+
import { addUnit, getPx } from "../../utils";
|
|
26
24
|
|
|
27
25
|
const props = withDefaults(defineProps<IProps>(), defaultProps);
|
|
28
|
-
const { text,
|
|
26
|
+
const { text, color, weight, size, slant, customStyle } = toRefs(props);
|
|
29
27
|
const emit = defineEmits(["click"]);
|
|
30
28
|
|
|
31
29
|
/**
|
|
@@ -33,13 +31,13 @@ const emit = defineEmits(["click"]);
|
|
|
33
31
|
* */
|
|
34
32
|
const priceStyle = computed<CSSProperties>(() => {
|
|
35
33
|
const style: CSSProperties = {
|
|
36
|
-
color:
|
|
34
|
+
color: color.value,
|
|
37
35
|
fontWeight: weight.value,
|
|
38
36
|
fontStyle: slant.value ? "oblique" : "",
|
|
39
|
-
fontSize: addUnit(
|
|
37
|
+
fontSize: addUnit(size.value),
|
|
40
38
|
};
|
|
41
39
|
|
|
42
|
-
return Object.assign(style, customStyle);
|
|
40
|
+
return Object.assign(style, customStyle.value);
|
|
43
41
|
});
|
|
44
42
|
|
|
45
43
|
/**
|
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
import type IProps from "./typing";
|
|
2
2
|
|
|
3
3
|
const defaultProps: IProps = {
|
|
4
|
-
text: "
|
|
4
|
+
text: "",
|
|
5
5
|
symbol: "¥",
|
|
6
|
+
ratio: 1.4,
|
|
6
7
|
num: 2,
|
|
7
|
-
|
|
8
|
-
|
|
8
|
+
color: "#FE3232",
|
|
9
|
+
size: 12,
|
|
9
10
|
weight: 500,
|
|
10
11
|
slant: false,
|
|
11
12
|
};
|
|
@@ -9,6 +9,10 @@ export default interface IProps {
|
|
|
9
9
|
* @description 金额符号(默认:¥)
|
|
10
10
|
* */
|
|
11
11
|
symbol?: string;
|
|
12
|
+
/**
|
|
13
|
+
* @description 比例大小(默认:1.4)
|
|
14
|
+
* */
|
|
15
|
+
ratio?: number;
|
|
12
16
|
/**
|
|
13
17
|
* @description 保留小数点后几位数(默认:2)
|
|
14
18
|
* */
|
|
@@ -16,15 +20,15 @@ export default interface IProps {
|
|
|
16
20
|
/**
|
|
17
21
|
* @description 字体颜色(默认:#FE3232)
|
|
18
22
|
* */
|
|
19
|
-
|
|
23
|
+
color?: string;
|
|
20
24
|
/**
|
|
21
|
-
* @description 字体大小(默认:
|
|
25
|
+
* @description 字体大小(默认:12)
|
|
22
26
|
* */
|
|
23
|
-
|
|
27
|
+
size?: string | number;
|
|
24
28
|
/**
|
|
25
29
|
* @description 字体粗细(默认:500)
|
|
26
30
|
* */
|
|
27
|
-
weight?:
|
|
31
|
+
weight?: number;
|
|
28
32
|
/**
|
|
29
33
|
* @description 是否倾斜(默认:false)
|
|
30
34
|
* */
|
|
@@ -364,7 +364,7 @@ const updateValue = (value: number, drag: boolean, index: number = 1) => {
|
|
|
364
364
|
width: width + "px",
|
|
365
365
|
};
|
|
366
366
|
// 移动期间无需过渡动画
|
|
367
|
-
if (drag
|
|
367
|
+
if (drag) {
|
|
368
368
|
barStyle_1.transition = "none";
|
|
369
369
|
} else {
|
|
370
370
|
// 非移动期间,删掉对过渡为空的声明,让css中的声明起效
|
|
@@ -421,9 +421,10 @@ const format = (value: number, index = 1): number => {
|
|
|
421
421
|
return 0;
|
|
422
422
|
}
|
|
423
423
|
} else {
|
|
424
|
+
// 解决精度丢失
|
|
424
425
|
return (
|
|
425
|
-
Math.round(Math.max(min.value, Math.min(value, max.value)) / step.value) *
|
|
426
|
-
step.value
|
|
426
|
+
Math.round(Math.max(min.value, Math.min(value, max.value)) / step.value) * 1000 *
|
|
427
|
+
step.value / 1000
|
|
427
428
|
);
|
|
428
429
|
}
|
|
429
430
|
};
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<Hy-cell title="基础组件" :list="list_1"></Hy-cell>
|
|
3
|
+
<hy-cell title="表单组件" :list="list_2"></hy-cell>
|
|
4
|
+
<hy-cell title="布局组件" :list="list_3"></hy-cell>
|
|
5
|
+
<hy-cell title="反馈组件" :list="list_4"></hy-cell>
|
|
6
|
+
<hy-cell title="导航组件" :list="list_5"></hy-cell>
|
|
7
|
+
<hy-cell title="其他组件" :list="list_6"></hy-cell>
|
|
8
|
+
<hy-cell title="业务组件" :list="list_7"></hy-cell>
|
|
9
|
+
</template>
|
|
10
|
+
|
|
11
|
+
<script setup lang="ts">
|
|
12
|
+
import HyCell from "hy-app/components/hy-cell/hy-cell.vue";
|
|
13
|
+
|
|
14
|
+
import { list_1, list_2, list_3, list_4, list_5, list_6, list_7 } from "./index1";
|
|
15
|
+
</script>
|
|
16
|
+
|
|
17
|
+
<style lang="scss" scoped></style>
|
|
@@ -0,0 +1,216 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<view
|
|
3
|
+
:class="['hy-submit-bar', border && 'hy-border__top']"
|
|
4
|
+
:style="submitBarStyle"
|
|
5
|
+
>
|
|
6
|
+
<view class="hy-submit-bar__left">
|
|
7
|
+
<slot name="left">
|
|
8
|
+
<view
|
|
9
|
+
class="hy-submit-bar__left--item"
|
|
10
|
+
v-for="(item, i) in menus"
|
|
11
|
+
:key="i"
|
|
12
|
+
@tap="clickMenuFn(i)"
|
|
13
|
+
>
|
|
14
|
+
<HyIcon
|
|
15
|
+
:name="item.icon"
|
|
16
|
+
:label="item.text"
|
|
17
|
+
:color="iconColor"
|
|
18
|
+
:label-color="iconLabelColor"
|
|
19
|
+
labelPos="bottom"
|
|
20
|
+
space="7"
|
|
21
|
+
:size="20"
|
|
22
|
+
></HyIcon>
|
|
23
|
+
<HyBadge
|
|
24
|
+
:value="item?.badge?.value"
|
|
25
|
+
:absolute="true"
|
|
26
|
+
:offset="item?.badge?.offset ?? [-5, 20]"
|
|
27
|
+
:isDot="item?.badge?.isDot"
|
|
28
|
+
:type="item?.badge?.type"
|
|
29
|
+
:color="item?.badge?.color"
|
|
30
|
+
:shape="item?.badge?.shape"
|
|
31
|
+
:numberType="item?.badge?.numberType"
|
|
32
|
+
:inverted="item?.badge?.inverted"
|
|
33
|
+
></HyBadge>
|
|
34
|
+
</view>
|
|
35
|
+
</slot>
|
|
36
|
+
</view>
|
|
37
|
+
<view class="hy-submit-bar__right">
|
|
38
|
+
<slot name="right">
|
|
39
|
+
<view
|
|
40
|
+
class="hy-submit-bar__right--button"
|
|
41
|
+
v-if="showLeftBtn"
|
|
42
|
+
:style="leftBtnStyle"
|
|
43
|
+
@tap.stop="confirmClickFn(0)"
|
|
44
|
+
>
|
|
45
|
+
<HyLoading
|
|
46
|
+
:show="leftLoading"
|
|
47
|
+
size="13"
|
|
48
|
+
mode="circle"
|
|
49
|
+
:custom-style="{ marginRight: '10rpx' }"
|
|
50
|
+
></HyLoading>
|
|
51
|
+
{{ leftBtnText }}
|
|
52
|
+
</view>
|
|
53
|
+
<view
|
|
54
|
+
class="hy-submit-bar__right--button"
|
|
55
|
+
v-if="showRightBtn"
|
|
56
|
+
:style="rightBtnStyle"
|
|
57
|
+
@tap.stop="confirmClickFn(1)"
|
|
58
|
+
>
|
|
59
|
+
<HyLoading
|
|
60
|
+
:show="rightLoading"
|
|
61
|
+
size="13"
|
|
62
|
+
mode="circle"
|
|
63
|
+
:custom-style="{ marginRight: '10rpx' }"
|
|
64
|
+
></HyLoading>
|
|
65
|
+
{{ rightBtnText }}
|
|
66
|
+
</view>
|
|
67
|
+
</slot>
|
|
68
|
+
</view>
|
|
69
|
+
</view>
|
|
70
|
+
</template>
|
|
71
|
+
|
|
72
|
+
<script setup lang="ts">
|
|
73
|
+
import type IProps from "./typing";
|
|
74
|
+
import defaultProps from "./props";
|
|
75
|
+
import { computed, type CSSProperties, toRefs } from "vue";
|
|
76
|
+
import { debounce } from "../../utils";
|
|
77
|
+
|
|
78
|
+
// 组件
|
|
79
|
+
import HyIcon from "../hy-icon/hy-icon.vue";
|
|
80
|
+
import HyLoading from "../hy-loading/hy-loading.vue";
|
|
81
|
+
import HyBadge from "../hy-badge/hy-badge.vue";
|
|
82
|
+
|
|
83
|
+
const props = withDefaults(defineProps<IProps>(), defaultProps);
|
|
84
|
+
const {
|
|
85
|
+
fixed,
|
|
86
|
+
showLeftBtn,
|
|
87
|
+
showRightBtn,
|
|
88
|
+
leftBtnColor,
|
|
89
|
+
rightBtnColor,
|
|
90
|
+
shape,
|
|
91
|
+
textColor,
|
|
92
|
+
leftLoading,
|
|
93
|
+
rightLoading,
|
|
94
|
+
warn,
|
|
95
|
+
customStyle,
|
|
96
|
+
} = toRefs(props);
|
|
97
|
+
const emit = defineEmits(["click", "menuClick"]);
|
|
98
|
+
|
|
99
|
+
/**
|
|
100
|
+
* @description 整体样式
|
|
101
|
+
* */
|
|
102
|
+
const submitBarStyle = computed(() => {
|
|
103
|
+
const style: CSSProperties = {
|
|
104
|
+
bottom: 0,
|
|
105
|
+
};
|
|
106
|
+
if (fixed.value) style.position = "fixed";
|
|
107
|
+
return Object.assign(style, customStyle.value);
|
|
108
|
+
});
|
|
109
|
+
|
|
110
|
+
/**
|
|
111
|
+
* @description 左边按钮样式
|
|
112
|
+
* */
|
|
113
|
+
const leftBtnStyle = computed(() => {
|
|
114
|
+
const style: CSSProperties = {
|
|
115
|
+
background: leftBtnColor.value,
|
|
116
|
+
color: textColor.value,
|
|
117
|
+
};
|
|
118
|
+
if (!showRightBtn.value) {
|
|
119
|
+
style.flex = 1;
|
|
120
|
+
if (shape.value === "circle") {
|
|
121
|
+
style.borderRadius = "100px";
|
|
122
|
+
} else {
|
|
123
|
+
style.borderRadius = "2px";
|
|
124
|
+
}
|
|
125
|
+
} else {
|
|
126
|
+
if (shape.value === "circle") {
|
|
127
|
+
style.borderRadius = "100px 0 0 100px";
|
|
128
|
+
} else {
|
|
129
|
+
style.borderRadius = "2px 0 0 2px";
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
return style;
|
|
133
|
+
});
|
|
134
|
+
|
|
135
|
+
/**
|
|
136
|
+
* @description 右边按钮样式
|
|
137
|
+
* */
|
|
138
|
+
const rightBtnStyle = computed(() => {
|
|
139
|
+
const style: CSSProperties = {
|
|
140
|
+
background: rightBtnColor.value,
|
|
141
|
+
color: textColor.value,
|
|
142
|
+
};
|
|
143
|
+
if (!showLeftBtn.value) {
|
|
144
|
+
style.flex = 1;
|
|
145
|
+
if (shape.value === "circle") {
|
|
146
|
+
style.borderRadius = "100px";
|
|
147
|
+
} else {
|
|
148
|
+
style.borderRadius = "2px";
|
|
149
|
+
}
|
|
150
|
+
} else {
|
|
151
|
+
if (shape.value === "circle") {
|
|
152
|
+
style.borderRadius = "0 100px 100px 0";
|
|
153
|
+
} else {
|
|
154
|
+
style.borderRadius = "0 2px 2px 0";
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
return style;
|
|
158
|
+
});
|
|
159
|
+
|
|
160
|
+
/**
|
|
161
|
+
* @description 点击左边图标
|
|
162
|
+
* */
|
|
163
|
+
const clickMenuFn = (i: number) => {
|
|
164
|
+
emit("menuClick", i);
|
|
165
|
+
};
|
|
166
|
+
|
|
167
|
+
/**
|
|
168
|
+
* @description 点击按钮
|
|
169
|
+
* */
|
|
170
|
+
const confirmClickFn = debounce((i: number) => {
|
|
171
|
+
if (
|
|
172
|
+
(!leftLoading.value && !rightLoading.value) ||
|
|
173
|
+
(leftLoading.value && i !== 0) ||
|
|
174
|
+
(rightLoading.value && i !== 1)
|
|
175
|
+
) {
|
|
176
|
+
emit("click", i);
|
|
177
|
+
}
|
|
178
|
+
}, warn.value);
|
|
179
|
+
</script>
|
|
180
|
+
|
|
181
|
+
<style lang="scss" scoped>
|
|
182
|
+
@import "../../theme.scss";
|
|
183
|
+
.hy-submit-bar {
|
|
184
|
+
display: flex;
|
|
185
|
+
background-color: #ffffff;
|
|
186
|
+
padding: $hy-border-margin-padding-base;
|
|
187
|
+
width: 100%;
|
|
188
|
+
box-sizing: border-box;
|
|
189
|
+
/*左边内容*/
|
|
190
|
+
&__left {
|
|
191
|
+
display: flex;
|
|
192
|
+
font-size: 20rpx;
|
|
193
|
+
flex: 1;
|
|
194
|
+
&--item {
|
|
195
|
+
margin: 0 $hy-border-margin-padding-base;
|
|
196
|
+
position: relative;
|
|
197
|
+
}
|
|
198
|
+
}
|
|
199
|
+
|
|
200
|
+
/*右边内容*/
|
|
201
|
+
&__right {
|
|
202
|
+
display: flex;
|
|
203
|
+
justify-content: flex-end;
|
|
204
|
+
font-size: 26rpx;
|
|
205
|
+
align-items: center;
|
|
206
|
+
width: 400rpx;
|
|
207
|
+
&--button {
|
|
208
|
+
padding: $hy-border-margin-padding-base $hy-border-margin-padding-lg;
|
|
209
|
+
color: #ffffff;
|
|
210
|
+
display: flex;
|
|
211
|
+
justify-content: center;
|
|
212
|
+
align-items: center;
|
|
213
|
+
}
|
|
214
|
+
}
|
|
215
|
+
}
|
|
216
|
+
</style>
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import type IProps from "./typing";
|
|
2
|
+
|
|
3
|
+
const defaultProps: IProps = {
|
|
4
|
+
menus: [],
|
|
5
|
+
fixed: true,
|
|
6
|
+
border: true,
|
|
7
|
+
leftLoading: false,
|
|
8
|
+
rightLoading: false,
|
|
9
|
+
iconColor: "",
|
|
10
|
+
iconLabelColor: "#909193FF",
|
|
11
|
+
textColor: "",
|
|
12
|
+
showLeftBtn: true,
|
|
13
|
+
showRightBtn: true,
|
|
14
|
+
leftBtnText: "加入购物车",
|
|
15
|
+
rightBtnText: "立即购买",
|
|
16
|
+
leftBtnColor: "#ed3f14",
|
|
17
|
+
rightBtnColor: "#ff7900",
|
|
18
|
+
shape: "circle",
|
|
19
|
+
warn: 300,
|
|
20
|
+
};
|
|
21
|
+
|
|
22
|
+
export default defaultProps;
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
import type { CSSProperties } from "vue";
|
|
2
|
+
import type BadgeProps from "../hy-badge/props";
|
|
3
|
+
|
|
4
|
+
interface IconMenus {
|
|
5
|
+
/**
|
|
6
|
+
* @description icon图标
|
|
7
|
+
* */
|
|
8
|
+
icon: string;
|
|
9
|
+
/**
|
|
10
|
+
* @description 文本
|
|
11
|
+
* */
|
|
12
|
+
text: string;
|
|
13
|
+
/**
|
|
14
|
+
* @description 徽标值
|
|
15
|
+
* */
|
|
16
|
+
badge?: BadgeProps["badge"];
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
export default interface IProps {
|
|
20
|
+
/**
|
|
21
|
+
* @description 左边菜单栏
|
|
22
|
+
* */
|
|
23
|
+
menus?: IconMenus[];
|
|
24
|
+
/**
|
|
25
|
+
* @description 绝对定位
|
|
26
|
+
* */
|
|
27
|
+
fixed?: boolean;
|
|
28
|
+
/**
|
|
29
|
+
* @description 是否显示边框
|
|
30
|
+
* */
|
|
31
|
+
border?: boolean;
|
|
32
|
+
/**
|
|
33
|
+
* @description 加载左边按钮loading
|
|
34
|
+
* */
|
|
35
|
+
leftLoading?: boolean;
|
|
36
|
+
/**
|
|
37
|
+
* @description 加载右边按钮loading
|
|
38
|
+
* */
|
|
39
|
+
rightLoading?: boolean;
|
|
40
|
+
/**
|
|
41
|
+
* @description 左边icon的颜色
|
|
42
|
+
* */
|
|
43
|
+
iconColor?: string;
|
|
44
|
+
/**
|
|
45
|
+
* @description 左边文字的颜色
|
|
46
|
+
* */
|
|
47
|
+
iconLabelColor?: string;
|
|
48
|
+
/**
|
|
49
|
+
* @description 右边按钮文字颜色
|
|
50
|
+
* */
|
|
51
|
+
textColor?: string;
|
|
52
|
+
/**
|
|
53
|
+
* @description 显示左边按钮
|
|
54
|
+
* */
|
|
55
|
+
showLeftBtn?: boolean;
|
|
56
|
+
/**
|
|
57
|
+
* @description 显示右边按钮
|
|
58
|
+
* */
|
|
59
|
+
showRightBtn?: boolean;
|
|
60
|
+
/**
|
|
61
|
+
* @description 左边按钮文字
|
|
62
|
+
* */
|
|
63
|
+
leftBtnText?: string;
|
|
64
|
+
/**
|
|
65
|
+
* @description 右边按钮文字
|
|
66
|
+
* */
|
|
67
|
+
rightBtnText?: string;
|
|
68
|
+
/**
|
|
69
|
+
* @description 左边按钮颜色,支持渐变色
|
|
70
|
+
* */
|
|
71
|
+
leftBtnColor?: string;
|
|
72
|
+
/**
|
|
73
|
+
* @description 有边按钮颜色,支持渐变色
|
|
74
|
+
* */
|
|
75
|
+
rightBtnColor?: string;
|
|
76
|
+
/**
|
|
77
|
+
* @description 按钮的形状
|
|
78
|
+
* */
|
|
79
|
+
shape?: HyApp.ShapeType;
|
|
80
|
+
/**
|
|
81
|
+
* @description 按钮点击等待时长(运用了节流方法)
|
|
82
|
+
* */
|
|
83
|
+
warn?: number;
|
|
84
|
+
/**
|
|
85
|
+
* @description 定义需要用到的外部样式
|
|
86
|
+
* */
|
|
87
|
+
customStyle?: CSSProperties;
|
|
88
|
+
}
|
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
:customStyle="{ marginRight: '3px' }"
|
|
12
12
|
></HyIcon>
|
|
13
13
|
</slot>
|
|
14
|
-
<text :class="textClass" :style="
|
|
14
|
+
<text :class="textClass" :style="textStyle">
|
|
15
15
|
<slot>
|
|
16
16
|
{{ text }}
|
|
17
17
|
</slot>
|
|
@@ -40,6 +40,7 @@ import type IProps from "./typing";
|
|
|
40
40
|
import HyTransition from "../hy-transition/hy-transition.vue";
|
|
41
41
|
import HyIcon from "../hy-icon/hy-icon.vue";
|
|
42
42
|
import { IconConfig } from "../../config";
|
|
43
|
+
import {colorGradient} from "@/package";
|
|
43
44
|
|
|
44
45
|
const props = withDefaults(defineProps<IProps>(), defaultProps);
|
|
45
46
|
const {
|
|
@@ -84,16 +85,33 @@ const tagStyle = computed<CSSProperties>(() => {
|
|
|
84
85
|
const style: CSSProperties = {
|
|
85
86
|
marginRight: closable.value ? "10px" : 0,
|
|
86
87
|
marginTop: closable.value ? "10px" : 0,
|
|
88
|
+
background: bgColor.value,
|
|
89
|
+
borderColor: borderColor.value
|
|
87
90
|
};
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
91
|
+
|
|
92
|
+
if(color.value) {
|
|
93
|
+
if (plain.value) {
|
|
94
|
+
style.borderColor = color.value;
|
|
95
|
+
if(plainFill.value) {
|
|
96
|
+
style.background = colorGradient(color.value, "#FFFFFF", 100)[90];
|
|
97
|
+
}
|
|
98
|
+
} else {
|
|
99
|
+
style.background = color.value;
|
|
100
|
+
style.borderColor = color.value;
|
|
101
|
+
}
|
|
93
102
|
}
|
|
103
|
+
|
|
94
104
|
return Object.assign(style, customStyle.value);
|
|
95
105
|
});
|
|
96
106
|
|
|
107
|
+
/**
|
|
108
|
+
* @description 文本样式
|
|
109
|
+
* */
|
|
110
|
+
const textStyle = computed(() => {
|
|
111
|
+
const style: CSSProperties = {}
|
|
112
|
+
if(color.value && plain.value) style.color = color.value;
|
|
113
|
+
return style;
|
|
114
|
+
})
|
|
97
115
|
/**
|
|
98
116
|
* @description 文本类名
|
|
99
117
|
* */
|