hy-app 0.2.2 → 0.2.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/index.scss +1 -3
- package/components/hy-cell/index.scss +0 -15
- package/components/hy-code-input/hy-code-input.vue +2 -1
- package/components/hy-code-input/typing.d.ts +1 -1
- package/components/hy-config-provider/props.ts +1 -1
- package/components/hy-grid/hy-grid.vue +2 -3
- package/components/hy-grid/props.ts +4 -0
- package/components/hy-grid/typing.d.ts +15 -0
- package/components/hy-icon/index.scss +2 -2
- package/components/hy-login/TheUserLogin.vue +0 -1
- package/components/hy-menu/hy-menu.vue +159 -0
- package/components/hy-menu/index.scss +58 -0
- package/components/hy-menu/props.ts +12 -0
- package/components/hy-menu/typing.d.ts +57 -0
- package/components/hy-notify/typing.d.ts +1 -1
- package/components/hy-pagination/typing.d.ts +1 -1
- package/components/hy-signature/hy-signature.vue +50 -50
- package/components/hy-signature/index.scss +2 -4
- package/components/hy-signature/props.ts +2 -1
- package/components/hy-signature/typing.d.ts +5 -1
- package/components/hy-subsection/hy-subsection.vue +15 -13
- package/components/hy-subsection/props.ts +2 -2
- package/components/hy-subsection/typing.d.ts +1 -1
- package/components/hy-tabBar/hy-tabBar.vue +96 -0
- package/components/hy-tabBar/index.scss +169 -0
- package/components/hy-tabBar/props.ts +13 -0
- package/components/hy-tabBar/typing.d.ts +54 -0
- package/components/hy-text/index.scss +2 -2
- package/components/hy-upload/index.scss +0 -1
- package/components/hy-watermark/hy-watermark.vue +603 -0
- package/components/hy-watermark/index.scss +15 -0
- package/components/hy-watermark/props.ts +23 -0
- package/components/hy-watermark/typing.d.ts +76 -0
- package/components/index.ts +2 -2
- package/index.ts +1 -1
- package/libs/css/vars.css +5 -1
- package/package.json +2 -2
- package/theme.scss +4 -3
- package/typing/modules/common.d.ts +1 -1
- package/utils/inspect.ts +20 -0
- package/utils/utils.ts +52 -22
- package/components/yk-tabbar/props.ts +0 -49
- package/components/yk-tabbar/yk-tabbar.vue +0 -224
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<view class="hy-signature" :style="customStyle">
|
|
3
|
-
<view
|
|
3
|
+
<view
|
|
4
|
+
class="hy-signature__content"
|
|
5
|
+
:style="{ borderRadius: addUnit(round) }"
|
|
6
|
+
>
|
|
4
7
|
<!-- #ifdef MP-WEIXIN -->
|
|
5
8
|
<canvas
|
|
6
9
|
class="hy-signature__content-canvas"
|
|
@@ -113,7 +116,7 @@ import HyButton from "@/package/components/hy-button/hy-button.vue";
|
|
|
113
116
|
|
|
114
117
|
const props = withDefaults(defineProps<IProps>(), defaultProps);
|
|
115
118
|
const emit = defineEmits(["start", "end", "signing", "confirm", "clear"]);
|
|
116
|
-
const
|
|
119
|
+
const instance = getCurrentInstance() as any;
|
|
117
120
|
const canvasId = ref<string>(`signature${guid()}`); // canvas 组件的唯一标识符
|
|
118
121
|
let canvas: null = null; //canvas对象 微信小程序生成图片必须传入
|
|
119
122
|
const drawing = ref<boolean>(false); // 是否正在绘制
|
|
@@ -160,7 +163,9 @@ const redoLines = ref<Line[]>([]); // 保存撤销的线条
|
|
|
160
163
|
const currentLine = ref<Line>(); // 当前正在绘制的线
|
|
161
164
|
const currentStep = ref(0); // 当前步骤
|
|
162
165
|
|
|
163
|
-
|
|
166
|
+
/**
|
|
167
|
+
* @description 添加计算笔画宽度的方法
|
|
168
|
+
* */
|
|
164
169
|
function calculateLineWidth(speed: number): number {
|
|
165
170
|
if (!props.pressure) return props.lineWidth;
|
|
166
171
|
|
|
@@ -172,7 +177,9 @@ function calculateLineWidth(speed: number): number {
|
|
|
172
177
|
return Math.min(lineWidth, props.maxWidth);
|
|
173
178
|
}
|
|
174
179
|
|
|
175
|
-
|
|
180
|
+
/**
|
|
181
|
+
* @description 获取默认笔画宽度
|
|
182
|
+
* */
|
|
176
183
|
const getDefaultLineWidth = () => {
|
|
177
184
|
if (props.pressure) {
|
|
178
185
|
// 在压感模式下,使用最大和最小宽度的平均值作为默认值
|
|
@@ -181,7 +188,9 @@ const getDefaultLineWidth = () => {
|
|
|
181
188
|
return props.lineWidth;
|
|
182
189
|
};
|
|
183
190
|
|
|
184
|
-
|
|
191
|
+
/**
|
|
192
|
+
* @description 开始画线
|
|
193
|
+
* */
|
|
185
194
|
const startDrawing = (e: any) => {
|
|
186
195
|
e.preventDefault();
|
|
187
196
|
drawing.value = true;
|
|
@@ -209,7 +218,9 @@ const startDrawing = (e: any) => {
|
|
|
209
218
|
draw(e);
|
|
210
219
|
};
|
|
211
220
|
|
|
212
|
-
|
|
221
|
+
/**
|
|
222
|
+
* @description 结束画线
|
|
223
|
+
* */
|
|
213
224
|
const stopDrawing = (e: TouchEvent) => {
|
|
214
225
|
e.preventDefault();
|
|
215
226
|
drawing.value = false;
|
|
@@ -239,7 +250,7 @@ const stopDrawing = (e: TouchEvent) => {
|
|
|
239
250
|
};
|
|
240
251
|
|
|
241
252
|
/**
|
|
242
|
-
* 初始化 canvas
|
|
253
|
+
* @description 初始化 canvas
|
|
243
254
|
* @param forceUpdate 是否强制更新
|
|
244
255
|
*/
|
|
245
256
|
const initCanvas = (forceUpdate: boolean = false) => {
|
|
@@ -257,7 +268,9 @@ const initCanvas = (forceUpdate: boolean = false) => {
|
|
|
257
268
|
});
|
|
258
269
|
};
|
|
259
270
|
|
|
260
|
-
|
|
271
|
+
/**
|
|
272
|
+
* @description 清空 canvas
|
|
273
|
+
* */
|
|
261
274
|
const clear = () => {
|
|
262
275
|
lines.value = [];
|
|
263
276
|
redoLines.value = [];
|
|
@@ -271,7 +284,9 @@ const confirmSignature = () => {
|
|
|
271
284
|
canvasToImage();
|
|
272
285
|
};
|
|
273
286
|
|
|
274
|
-
|
|
287
|
+
/**
|
|
288
|
+
* @description canvas划线
|
|
289
|
+
* */
|
|
275
290
|
const draw = (e: any) => {
|
|
276
291
|
e.preventDefault();
|
|
277
292
|
const { ctx } = canvasState;
|
|
@@ -334,7 +349,9 @@ const draw = (e: any) => {
|
|
|
334
349
|
emit("signing", e);
|
|
335
350
|
};
|
|
336
351
|
|
|
337
|
-
|
|
352
|
+
/**
|
|
353
|
+
* @description 重绘整个画布
|
|
354
|
+
* */
|
|
338
355
|
const redrawCanvas = () => {
|
|
339
356
|
const { ctx } = canvasState;
|
|
340
357
|
if (!ctx) return;
|
|
@@ -388,32 +405,7 @@ const redrawCanvas = () => {
|
|
|
388
405
|
}
|
|
389
406
|
|
|
390
407
|
const lineWidth = point.lineWidth || line.width;
|
|
391
|
-
|
|
392
|
-
ctx.setLineWidth(lineWidth);
|
|
393
|
-
ctx.beginPath();
|
|
394
|
-
ctx.moveTo(prePoint.lastX2!, prePoint.lastY2!);
|
|
395
|
-
ctx.quadraticCurveTo(
|
|
396
|
-
prePoint.x,
|
|
397
|
-
prePoint.y,
|
|
398
|
-
point.lastX1,
|
|
399
|
-
point.lastY1,
|
|
400
|
-
);
|
|
401
|
-
ctx.stroke();
|
|
402
|
-
|
|
403
|
-
if (!prePoint.isFirstPoint) {
|
|
404
|
-
ctx.beginPath();
|
|
405
|
-
ctx.moveTo(prePoint.lastX1!, prePoint.lastY1!);
|
|
406
|
-
ctx.quadraticCurveTo(
|
|
407
|
-
prePoint.x,
|
|
408
|
-
prePoint.y,
|
|
409
|
-
prePoint.lastX2!,
|
|
410
|
-
prePoint.lastY2!,
|
|
411
|
-
);
|
|
412
|
-
ctx.stroke();
|
|
413
|
-
}
|
|
414
|
-
} else {
|
|
415
|
-
point.isFirstPoint = true;
|
|
416
|
-
}
|
|
408
|
+
point.isFirstPoint = true;
|
|
417
409
|
});
|
|
418
410
|
} else {
|
|
419
411
|
// 非笔锋模式的重绘
|
|
@@ -433,7 +425,9 @@ const redrawCanvas = () => {
|
|
|
433
425
|
ctx.draw();
|
|
434
426
|
};
|
|
435
427
|
|
|
436
|
-
|
|
428
|
+
/**
|
|
429
|
+
* @description 修改撤销功能
|
|
430
|
+
* */
|
|
437
431
|
const revoke = () => {
|
|
438
432
|
if (!lines.value.length) return;
|
|
439
433
|
const step = Math.min(props.step, lines.value.length);
|
|
@@ -443,7 +437,9 @@ const revoke = () => {
|
|
|
443
437
|
redrawCanvas();
|
|
444
438
|
};
|
|
445
439
|
|
|
446
|
-
|
|
440
|
+
/**
|
|
441
|
+
* @description 修改恢复功能
|
|
442
|
+
* */
|
|
447
443
|
const restore = () => {
|
|
448
444
|
if (!redoLines.value.length) return;
|
|
449
445
|
const step = Math.min(props.step, redoLines.value.length);
|
|
@@ -453,7 +449,9 @@ const restore = () => {
|
|
|
453
449
|
redrawCanvas();
|
|
454
450
|
};
|
|
455
451
|
|
|
456
|
-
|
|
452
|
+
/**
|
|
453
|
+
* @description 添加平滑线条绘制方法
|
|
454
|
+
* */
|
|
457
455
|
function drawSmoothLine(prePoint: Point, point: Point) {
|
|
458
456
|
const { ctx } = canvasState;
|
|
459
457
|
if (!ctx) return;
|
|
@@ -524,7 +522,7 @@ onBeforeMount(() => {
|
|
|
524
522
|
});
|
|
525
523
|
|
|
526
524
|
/**
|
|
527
|
-
* 获取canvas上下文
|
|
525
|
+
* @description 获取canvas上下文
|
|
528
526
|
*/
|
|
529
527
|
function getContext() {
|
|
530
528
|
return new Promise<UniApp.CanvasContext>((resolve) => {
|
|
@@ -534,9 +532,9 @@ function getContext() {
|
|
|
534
532
|
return resolve(ctx);
|
|
535
533
|
}
|
|
536
534
|
// #ifndef MP-WEIXIN
|
|
537
|
-
getRect(`#${canvasId.value}`, false,
|
|
538
|
-
|
|
539
|
-
canvasState.ctx = uni.createCanvasContext(canvasId.value, proxy);
|
|
535
|
+
getRect(`#${canvasId.value}`, false, instance).then((canvasRect) => {
|
|
536
|
+
setCanvasState(canvasRect.width!, canvasRect.height!);
|
|
537
|
+
canvasState.ctx = uni.createCanvasContext(canvasId.value, instance.proxy);
|
|
540
538
|
if (canvasState.ctx) {
|
|
541
539
|
canvasState.ctx.scale(pixelRatio.value, pixelRatio.value);
|
|
542
540
|
}
|
|
@@ -545,7 +543,7 @@ function getContext() {
|
|
|
545
543
|
// #endif
|
|
546
544
|
// #ifdef MP-WEIXIN
|
|
547
545
|
|
|
548
|
-
getRect(`#${canvasId.value}`, false,
|
|
546
|
+
getRect(`#${canvasId.value}`, false, instance, true).then(
|
|
549
547
|
(canvasRect: any) => {
|
|
550
548
|
if (
|
|
551
549
|
canvasRect &&
|
|
@@ -561,7 +559,7 @@ function getContext() {
|
|
|
561
559
|
canvasInstance.height = canvasRect.height * pixelRatio.value;
|
|
562
560
|
canvasState.ctx.scale(pixelRatio.value, pixelRatio.value);
|
|
563
561
|
canvas = canvasInstance;
|
|
564
|
-
|
|
562
|
+
setCanvasState(canvasRect.width, canvasRect.height);
|
|
565
563
|
resolve(canvasState.ctx);
|
|
566
564
|
}
|
|
567
565
|
},
|
|
@@ -571,14 +569,16 @@ function getContext() {
|
|
|
571
569
|
}
|
|
572
570
|
|
|
573
571
|
/**
|
|
574
|
-
* 设置 canvasState
|
|
572
|
+
* @description 设置 canvasState
|
|
575
573
|
*/
|
|
576
|
-
function
|
|
574
|
+
function setCanvasState(width: number, height: number) {
|
|
577
575
|
canvasState.canvasHeight = height * pixelRatio.value;
|
|
578
576
|
canvasState.canvasWidth = width * pixelRatio.value;
|
|
579
577
|
}
|
|
580
578
|
|
|
581
|
-
|
|
579
|
+
/**
|
|
580
|
+
* @description 设置线段
|
|
581
|
+
* */
|
|
582
582
|
function setLine() {
|
|
583
583
|
const { ctx } = canvasState;
|
|
584
584
|
if (ctx) {
|
|
@@ -590,7 +590,7 @@ function setLine() {
|
|
|
590
590
|
}
|
|
591
591
|
|
|
592
592
|
/**
|
|
593
|
-
* canvas 绘制图片输出成文件类型
|
|
593
|
+
* @description canvas 绘制图片输出成文件类型
|
|
594
594
|
*/
|
|
595
595
|
function canvasToImage() {
|
|
596
596
|
const { fileType, quality, exportScale } = props;
|
|
@@ -627,7 +627,7 @@ function canvasToImage() {
|
|
|
627
627
|
emit("confirm", result);
|
|
628
628
|
},
|
|
629
629
|
},
|
|
630
|
-
proxy,
|
|
630
|
+
instance.proxy,
|
|
631
631
|
);
|
|
632
632
|
}
|
|
633
633
|
|
|
@@ -2,7 +2,7 @@ import type IProps from "./typing";
|
|
|
2
2
|
|
|
3
3
|
const defaultProps: IProps = {
|
|
4
4
|
penColor: "#000",
|
|
5
|
-
lineWidth:
|
|
5
|
+
lineWidth: 2,
|
|
6
6
|
clearText: "清空",
|
|
7
7
|
revokeText: "撤销",
|
|
8
8
|
restoreText: "恢复",
|
|
@@ -13,6 +13,7 @@ const defaultProps: IProps = {
|
|
|
13
13
|
disabled: false,
|
|
14
14
|
height: 1,
|
|
15
15
|
width: 1,
|
|
16
|
+
round: "10rpx",
|
|
16
17
|
backgroundColor: "",
|
|
17
18
|
disableScroll: true,
|
|
18
19
|
enableHistory: false,
|
|
@@ -6,7 +6,7 @@ export default interface HySignatureProps {
|
|
|
6
6
|
* */
|
|
7
7
|
penColor?: string;
|
|
8
8
|
/**
|
|
9
|
-
* @description 签名笔宽度(默认
|
|
9
|
+
* @description 签名笔宽度(默认 2 )
|
|
10
10
|
* */
|
|
11
11
|
lineWidth?: number;
|
|
12
12
|
/**
|
|
@@ -49,6 +49,10 @@ export default interface HySignatureProps {
|
|
|
49
49
|
* @description 画布的宽度
|
|
50
50
|
* */
|
|
51
51
|
width?: number;
|
|
52
|
+
/**
|
|
53
|
+
* @description 边框圆角
|
|
54
|
+
* */
|
|
55
|
+
round?: string | number;
|
|
52
56
|
/**
|
|
53
57
|
* @description 画板的背景色
|
|
54
58
|
* */
|
|
@@ -22,17 +22,17 @@
|
|
|
22
22
|
|
|
23
23
|
<script lang="ts">
|
|
24
24
|
export default {
|
|
25
|
-
name:
|
|
25
|
+
name: "hy-subsection",
|
|
26
26
|
options: {
|
|
27
27
|
addGlobalClass: true,
|
|
28
28
|
virtualHost: true,
|
|
29
|
-
styleIsolation:
|
|
30
|
-
}
|
|
31
|
-
}
|
|
29
|
+
styleIsolation: "shared",
|
|
30
|
+
},
|
|
31
|
+
};
|
|
32
32
|
</script>
|
|
33
33
|
|
|
34
34
|
<script setup lang="ts">
|
|
35
|
-
import {computed, toRefs, ref, onMounted,
|
|
35
|
+
import { computed, toRefs, ref, onMounted, getCurrentInstance } from "vue";
|
|
36
36
|
import type { CSSProperties } from "vue";
|
|
37
37
|
import defaultProps from "./props";
|
|
38
38
|
import type IProps from "./typing";
|
|
@@ -50,7 +50,7 @@ const {
|
|
|
50
50
|
bold,
|
|
51
51
|
bgColor,
|
|
52
52
|
inactiveColor,
|
|
53
|
-
|
|
53
|
+
customKeys,
|
|
54
54
|
} = toRefs(props);
|
|
55
55
|
const emit = defineEmits(["change", "update:modelValue"]);
|
|
56
56
|
|
|
@@ -83,7 +83,7 @@ const wrapperClass = computed(() => {
|
|
|
83
83
|
"hy-subsection__item",
|
|
84
84
|
"cursor-pointer",
|
|
85
85
|
`hy-subsection__item--${innerCurrent.value}__${guidClass}`,
|
|
86
|
-
|
|
86
|
+
`hy-subsection__item--${mode.value}`,
|
|
87
87
|
index < list.value.length - 1 && "hy-subsection__item--no-border-right",
|
|
88
88
|
index === 0 && "hy-subsection__item--first",
|
|
89
89
|
index === list.value.length - 1 && "hy-subsection__item--last",
|
|
@@ -175,7 +175,7 @@ const init = () => {
|
|
|
175
175
|
if (typeof item === "string" || typeof item === "number") {
|
|
176
176
|
return item === modelValue.value;
|
|
177
177
|
} else {
|
|
178
|
-
return item[
|
|
178
|
+
return item[customKeys.value.value] === modelValue.value;
|
|
179
179
|
}
|
|
180
180
|
});
|
|
181
181
|
|
|
@@ -184,23 +184,25 @@ const init = () => {
|
|
|
184
184
|
innerCurrent.value === -1 ? current.value : innerCurrent.value;
|
|
185
185
|
|
|
186
186
|
// TODO: 多个数组在一起计算宽度, 宽度不一样会有问题,所以必须加guidClass随机数
|
|
187
|
-
getRect(`.hy-subsection__item--0__${guidClass}`, false, instance).then(
|
|
188
|
-
|
|
189
|
-
|
|
187
|
+
getRect(`.hy-subsection__item--0__${guidClass}`, false, instance).then(
|
|
188
|
+
(size) => {
|
|
189
|
+
itemRect.value = size as UniApp.NodeInfo;
|
|
190
|
+
},
|
|
191
|
+
);
|
|
190
192
|
};
|
|
191
193
|
|
|
192
194
|
/**
|
|
193
195
|
* @description 判断值
|
|
194
196
|
* */
|
|
195
197
|
const getValue = (item: SubSectionVo) => {
|
|
196
|
-
return typeof item === "object" ? item[
|
|
198
|
+
return typeof item === "object" ? item[customKeys.value.value] : item;
|
|
197
199
|
};
|
|
198
200
|
|
|
199
201
|
/**
|
|
200
202
|
* @description 判断展示文本
|
|
201
203
|
* */
|
|
202
204
|
const getName = (item: SubSectionVo) => {
|
|
203
|
-
return typeof item === "object" ? item[
|
|
205
|
+
return typeof item === "object" ? item[customKeys.value.name] : item;
|
|
204
206
|
};
|
|
205
207
|
|
|
206
208
|
/**
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<view class="hy-tabBar--placeholder"></view>
|
|
3
|
+
<view class="hy-tabBar">
|
|
4
|
+
<view class="hy-tabBar--box" :style="{ backgroundColor: barBgColor }">
|
|
5
|
+
<view class="hy-tabBar--container">
|
|
6
|
+
<view
|
|
7
|
+
:class="[
|
|
8
|
+
'hy-tabBar--container__item',
|
|
9
|
+
'list',
|
|
10
|
+
current === i ? 'is-active' : '',
|
|
11
|
+
]"
|
|
12
|
+
v-for="(item, i) in list"
|
|
13
|
+
:key="i"
|
|
14
|
+
@click="checkItem(i)"
|
|
15
|
+
>
|
|
16
|
+
<view class="hy-tabBar--container__item--bar">
|
|
17
|
+
<view class="icon">
|
|
18
|
+
<HyBadge
|
|
19
|
+
:value="item?.badge"
|
|
20
|
+
absolute
|
|
21
|
+
:offset="[-13, 25]"
|
|
22
|
+
:max="badge?.max"
|
|
23
|
+
:is-dot="badge?.isDot"
|
|
24
|
+
:inverted="badge?.inverted"
|
|
25
|
+
:bg-color="badge?.bgColor"
|
|
26
|
+
:type="badge?.type"
|
|
27
|
+
:number-type="badge?.numberType"
|
|
28
|
+
:shape="badge?.shape"
|
|
29
|
+
:show-zero="badge?.showZero"
|
|
30
|
+
:show="!!item?.badge"
|
|
31
|
+
></HyBadge>
|
|
32
|
+
<HyIcon :name="item.icon" :color="color" size="25"></HyIcon>
|
|
33
|
+
</view>
|
|
34
|
+
<text class="text" :style="[{ color: color }]">{{
|
|
35
|
+
item.name
|
|
36
|
+
}}</text>
|
|
37
|
+
<text class="circle"></text>
|
|
38
|
+
</view>
|
|
39
|
+
</view>
|
|
40
|
+
<view
|
|
41
|
+
class="hy-tabBar--indicator"
|
|
42
|
+
:style="{
|
|
43
|
+
'--num': `translateX(calc(((100vw - 110rpx - ${list.length} * 70rpx) / ${list.length - 1} + 70rpx) * ${current}))`,
|
|
44
|
+
background: activeColor,
|
|
45
|
+
}"
|
|
46
|
+
></view>
|
|
47
|
+
</view>
|
|
48
|
+
</view>
|
|
49
|
+
</view>
|
|
50
|
+
</template>
|
|
51
|
+
|
|
52
|
+
<script setup lang="ts">
|
|
53
|
+
import { ref, toRefs, watch } from "vue";
|
|
54
|
+
import defaultProps from "./props";
|
|
55
|
+
import type IProps from "./typing";
|
|
56
|
+
|
|
57
|
+
// 组件
|
|
58
|
+
import HyIcon from "../hy-icon/hy-icon.vue";
|
|
59
|
+
import HyBadge from "../hy-badge/hy-badge.vue";
|
|
60
|
+
|
|
61
|
+
const props = withDefaults(defineProps<IProps>(), defaultProps);
|
|
62
|
+
const { modelValue, baseBgColor } = toRefs(props);
|
|
63
|
+
const emit = defineEmits(["clickTab"]);
|
|
64
|
+
|
|
65
|
+
const baseBackgroundColor = baseBgColor.value
|
|
66
|
+
? baseBgColor.value
|
|
67
|
+
: "var(--hy-background)";
|
|
68
|
+
const current = ref(0);
|
|
69
|
+
watch(
|
|
70
|
+
() => modelValue.value,
|
|
71
|
+
(newVal) => {
|
|
72
|
+
current.value = newVal;
|
|
73
|
+
},
|
|
74
|
+
);
|
|
75
|
+
|
|
76
|
+
const checkItem = (index: number) => {
|
|
77
|
+
current.value = index;
|
|
78
|
+
emit("clickTab", index);
|
|
79
|
+
};
|
|
80
|
+
</script>
|
|
81
|
+
|
|
82
|
+
<style lang="scss" scoped>
|
|
83
|
+
@import "./index.scss";
|
|
84
|
+
.hy-tabBar {
|
|
85
|
+
background: v-bind(baseBackgroundColor);
|
|
86
|
+
&--indicator {
|
|
87
|
+
border: 12rpx solid v-bind(baseBackgroundColor);
|
|
88
|
+
&::before {
|
|
89
|
+
box-shadow: 1px -15rpx 0 v-bind(baseBackgroundColor);
|
|
90
|
+
}
|
|
91
|
+
&::after {
|
|
92
|
+
box-shadow: -1px -15rpx 0 v-bind(baseBackgroundColor);
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
</style>
|
|
@@ -0,0 +1,169 @@
|
|
|
1
|
+
@use "../../theme.scss" as *;
|
|
2
|
+
@use "../../libs/css/mixin.scss" as *;
|
|
3
|
+
|
|
4
|
+
@include b(tabBar) {
|
|
5
|
+
height: 135rpx;
|
|
6
|
+
z-index: 999;
|
|
7
|
+
position: fixed;
|
|
8
|
+
bottom: 0;
|
|
9
|
+
@include m(placeholder) {
|
|
10
|
+
height: 135rpx;
|
|
11
|
+
position: relative;
|
|
12
|
+
bottom: 0;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
@include m(box) {
|
|
16
|
+
margin-top: 15rpx;
|
|
17
|
+
position: relative;
|
|
18
|
+
width: 100vw;
|
|
19
|
+
height: 120rpx;
|
|
20
|
+
display: flex;
|
|
21
|
+
justify-content: center;
|
|
22
|
+
align-items: center;
|
|
23
|
+
border-radius: 15rpx 15rpx 0 0;
|
|
24
|
+
padding: 0 20rpx;
|
|
25
|
+
/* #ifndef APP-PLUS-NVUE */
|
|
26
|
+
box-sizing: border-box;
|
|
27
|
+
/* #endif */
|
|
28
|
+
background-color: $hy-background--container;
|
|
29
|
+
}
|
|
30
|
+
@include m(container) {
|
|
31
|
+
width: 100%;
|
|
32
|
+
display: flex;
|
|
33
|
+
justify-content: space-between;
|
|
34
|
+
align-items: center;
|
|
35
|
+
padding: 0 20rpx;
|
|
36
|
+
&__item {
|
|
37
|
+
position: relative;
|
|
38
|
+
width: 100rpx;
|
|
39
|
+
height: 70rpx;
|
|
40
|
+
z-index: 1;
|
|
41
|
+
|
|
42
|
+
/* #ifndef APP-PLUS-NVUE */
|
|
43
|
+
&:nth-child(1).is-active ~ .hy-tabBar--indicator {
|
|
44
|
+
transform: var(--num);
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
&:nth-child(2).is-active ~ .hy-tabBar--indicator {
|
|
48
|
+
transform: var(--num);
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
&:nth-child(3).is-active ~ .hy-tabBar--indicator {
|
|
52
|
+
transform: var(--num);
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
&:nth-child(4).is-active ~ .hy-tabBar--indicator {
|
|
56
|
+
transform: var(--num);
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
&:nth-child(5).is-active ~ .hy-tabBar--indicator {
|
|
60
|
+
transform: var(--num);
|
|
61
|
+
}
|
|
62
|
+
/* #endif */
|
|
63
|
+
|
|
64
|
+
&--bar {
|
|
65
|
+
position: relative;
|
|
66
|
+
display: flex;
|
|
67
|
+
justify-content: center;
|
|
68
|
+
align-items: center;
|
|
69
|
+
flex-direction: column;
|
|
70
|
+
width: 100%;
|
|
71
|
+
text-align: center;
|
|
72
|
+
font-weight: 500;
|
|
73
|
+
.icon {
|
|
74
|
+
/* #ifndef APP-PLUS-NVUE */
|
|
75
|
+
transition: 0.5s;
|
|
76
|
+
/* #endif */
|
|
77
|
+
position: relative;
|
|
78
|
+
}
|
|
79
|
+
.text {
|
|
80
|
+
position: absolute;
|
|
81
|
+
font-weight: 400;
|
|
82
|
+
font-size: 0.75em;
|
|
83
|
+
/* #ifndef APP-PLUS-NVUE */
|
|
84
|
+
letter-spacing: 0.05em;
|
|
85
|
+
transition: 0.5s;
|
|
86
|
+
/* #endif */
|
|
87
|
+
transform: translateY(20px) scale(0);
|
|
88
|
+
}
|
|
89
|
+
.circle {
|
|
90
|
+
position: absolute;
|
|
91
|
+
/* #ifndef APP-PLUS-NVUE */
|
|
92
|
+
display: block;
|
|
93
|
+
/* #endif */
|
|
94
|
+
width: 75rpx;
|
|
95
|
+
height: 75rpx;
|
|
96
|
+
background: transparent;
|
|
97
|
+
border-radius: 50%;
|
|
98
|
+
border: 3rpx solid #fff;
|
|
99
|
+
transform: translateY(-70rpx) scale(0);
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
@include is(active) {
|
|
104
|
+
@include b(tabBar--container__item--bar) {
|
|
105
|
+
.icon {
|
|
106
|
+
transform: translate(2rpx, -56rpx);
|
|
107
|
+
:deep(.hy-icon) {
|
|
108
|
+
color: #FFFFFF;
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
.text {
|
|
112
|
+
opacity: 1;
|
|
113
|
+
transform: translateY(20rpx);
|
|
114
|
+
}
|
|
115
|
+
.circle {
|
|
116
|
+
/* #ifndef APP-PLUS-NVUE */
|
|
117
|
+
margin: 0 auto;
|
|
118
|
+
transition: 0.5s;
|
|
119
|
+
/* #endif */
|
|
120
|
+
transition-delay: 0.5s;
|
|
121
|
+
transform: translate(2rpx, -56rpx) scale(1);
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
@include m(indicator) {
|
|
129
|
+
position: absolute;
|
|
130
|
+
top: -59%;
|
|
131
|
+
left: 30rpx;
|
|
132
|
+
width: 100rpx;
|
|
133
|
+
height: 100rpx;
|
|
134
|
+
border-radius: 50%;
|
|
135
|
+
display: flex;
|
|
136
|
+
justify-content: center;
|
|
137
|
+
align-items: center;
|
|
138
|
+
background-color: $hy-primary;
|
|
139
|
+
/* #ifndef APP-PLUS-NVUE */
|
|
140
|
+
transition: 0.5s;
|
|
141
|
+
/* #endif */
|
|
142
|
+
|
|
143
|
+
@include pseudo(before) {
|
|
144
|
+
/* #ifndef APP-PLUS-NVUE */
|
|
145
|
+
content: "";
|
|
146
|
+
/* #endif */
|
|
147
|
+
position: absolute;
|
|
148
|
+
top: 59%;
|
|
149
|
+
left: -45rpx;
|
|
150
|
+
width: 50rpx;
|
|
151
|
+
height: 40rpx;
|
|
152
|
+
background: transparent;
|
|
153
|
+
border-top-right-radius: 20px;
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
@include pseudo(after) {
|
|
157
|
+
/* #ifndef APP-PLUS-NVUE */
|
|
158
|
+
content: "";
|
|
159
|
+
/* #endif */
|
|
160
|
+
position: absolute;
|
|
161
|
+
top: 58%;
|
|
162
|
+
right: -49rpx;
|
|
163
|
+
width: 50rpx;
|
|
164
|
+
height: 40rpx;
|
|
165
|
+
background: transparent;
|
|
166
|
+
border-top-left-radius: 40rpx;
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
}
|