hy-app 0.1.2 → 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/README.md +1 -1
- package/api/http.ts +8 -8
- package/components/dialog/index.ts +2 -2
- package/components/hy-address-picker/hy-address-picker.vue +3 -29
- package/components/hy-address-picker/index.scss +27 -0
- package/components/hy-avatar/hy-avatar.vue +1 -45
- package/components/hy-avatar/index.scss +45 -0
- package/components/hy-avatar/typing.d.ts +1 -1
- package/components/hy-back-top/hy-back-top.vue +7 -22
- package/components/hy-back-top/index.scss +16 -0
- package/components/hy-back-top/props.ts +4 -4
- package/components/hy-back-top/typing.d.ts +2 -3
- package/components/hy-badge/hy-badge.vue +1 -72
- package/components/hy-badge/index.scss +72 -0
- package/components/hy-button/hy-button.vue +17 -128
- package/components/hy-button/index.scss +116 -0
- package/components/hy-button/typing.d.ts +1 -1
- package/components/hy-calendar/header.vue +76 -0
- package/components/hy-calendar/hy-calendar.vue +366 -0
- package/components/hy-calendar/index.scss +171 -0
- package/components/hy-calendar/month.vue +524 -0
- package/components/hy-calendar/props.ts +37 -0
- package/components/hy-calendar/typing.d.ts +126 -0
- package/components/hy-card/hy-card.vue +21 -84
- package/components/hy-card/index.scss +57 -0
- package/components/hy-card/props.ts +2 -2
- package/components/hy-card/typing.d.ts +1 -1
- package/components/hy-cell/hy-cell.vue +1 -137
- package/components/hy-cell/index.scss +137 -0
- package/components/hy-check-button/hy-check-button.vue +1 -0
- package/components/hy-check-button/index.scss +5 -0
- package/components/hy-checkbox/hy-checkbox.vue +2 -95
- package/components/hy-checkbox/index.scss +94 -0
- package/components/hy-checkbox/typing.d.ts +1 -2
- package/components/hy-count-down/hy-count-down.vue +150 -0
- package/components/hy-count-down/index.scss +6 -0
- package/components/hy-count-down/index.ts +52 -0
- package/components/hy-count-down/props.ts +10 -0
- package/components/hy-count-down/typing.d.ts +20 -0
- package/components/hy-count-to/hy-count-to.vue +213 -0
- package/components/hy-count-to/index.scss +6 -0
- package/components/hy-count-to/props.ts +17 -0
- package/components/hy-count-to/typing.d.ts +48 -0
- package/components/hy-datetime-picker/hy-datetime-picker.vue +2 -28
- package/components/hy-datetime-picker/index.scss +28 -0
- package/components/hy-divider/hy-divider.vue +24 -49
- package/components/hy-divider/index.scss +26 -0
- package/components/hy-divider/props.ts +2 -2
- package/components/hy-divider/typing.d.ts +1 -1
- package/components/hy-dropdown/hy-dropdown.vue +43 -0
- package/components/hy-dropdown/index.scss +17 -0
- package/components/hy-dropdown/props.ts +17 -0
- package/components/hy-dropdown/typing.d.ts +48 -0
- package/components/hy-dropdown-item/hy-dropdown-item.vue +194 -0
- package/components/hy-dropdown-item/index.scss +96 -0
- package/components/hy-dropdown-item/props.ts +10 -0
- package/components/hy-dropdown-item/typing.d.ts +31 -0
- package/components/hy-empty/hy-empty.vue +8 -26
- package/components/hy-empty/index.scss +19 -0
- package/components/hy-empty/props.ts +2 -2
- package/components/hy-empty/typing.d.ts +1 -1
- package/components/hy-float-button/hy-float-button.vue +217 -0
- package/components/hy-float-button/index.scss +67 -0
- package/components/hy-float-button/props.ts +25 -0
- package/components/hy-float-button/typing.d.ts +93 -0
- package/components/hy-folding-panel/hy-folding-panel.vue +9 -12
- package/components/hy-folding-panel/index.scss +6 -0
- package/components/hy-folding-panel/props.ts +2 -2
- package/components/hy-folding-panel/typing.d.ts +2 -2
- package/components/hy-form/hy-form.vue +17 -34
- package/components/hy-form/index.scss +30 -0
- package/components/hy-form/props.ts +2 -0
- package/components/hy-form/typing.d.ts +9 -1
- package/components/hy-grid/hy-grid.vue +1 -43
- package/components/hy-grid/index.scss +40 -0
- package/components/hy-icon/hy-icon.vue +1 -93
- package/components/hy-icon/index.scss +84 -0
- package/components/hy-image/hy-image.vue +216 -0
- package/components/hy-image/index.scss +26 -0
- package/components/hy-image/props.ts +24 -0
- package/components/hy-image/typing.d.ts +76 -0
- package/components/hy-input/hy-input.vue +2 -72
- package/components/hy-input/index.scss +65 -0
- package/components/hy-line/hy-line.vue +4 -8
- package/components/hy-line/index.scss +5 -0
- package/components/hy-line/props.ts +3 -3
- package/components/hy-line/typing.d.ts +2 -2
- package/components/hy-line-progress/hy-line-progress.vue +15 -44
- package/components/hy-line-progress/index.scss +38 -0
- package/components/hy-line-progress/props.ts +2 -2
- package/components/hy-line-progress/typing.d.ts +1 -1
- package/components/hy-list/hy-list.vue +11 -41
- package/components/hy-list/index.scss +32 -0
- package/components/hy-list/props.ts +2 -2
- package/components/hy-loading/hy-loading.vue +95 -0
- package/components/hy-loading/index.scss +103 -0
- package/components/hy-loading/props.ts +17 -0
- package/components/hy-loading/typing.d.ts +53 -0
- package/components/hy-login/TheUserLogin.vue +20 -88
- package/components/hy-login/hy-login.vue +9 -9
- package/components/hy-login/props.ts +4 -4
- package/components/hy-modal/hy-modal.vue +11 -89
- package/components/hy-modal/index.scss +77 -0
- package/components/hy-modal/props.ts +2 -2
- package/components/hy-modal/typing.d.ts +1 -1
- package/components/hy-navbar/hy-navbar.vue +20 -92
- package/components/hy-navbar/index.scss +67 -0
- package/components/hy-navbar/props.ts +2 -2
- package/components/hy-navbar/typing.d.ts +1 -1
- package/components/hy-notice-bar/hy-column-notice.vue +11 -39
- package/components/hy-notice-bar/hy-notice-bar.vue +10 -12
- package/components/hy-notice-bar/hy-row-notice.vue +16 -58
- package/components/hy-notice-bar/index.scss +93 -0
- package/components/hy-notice-bar/props.ts +4 -2
- package/components/hy-notice-bar/typing.d.ts +13 -3
- package/components/hy-number-step/hy-number-step.vue +1 -70
- package/components/hy-number-step/index.scss +71 -0
- package/components/hy-overlay/hy-overlay.vue +2 -14
- package/components/hy-overlay/index.scss +9 -0
- 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-picker/hy-picker.vue +1 -68
- package/components/hy-picker/index.scss +68 -0
- package/components/hy-popup/hy-popup.vue +1 -74
- package/components/hy-popup/index.scss +60 -0
- package/components/hy-price/hy-price.vue +7 -19
- package/components/hy-price/index.scss +11 -0
- package/components/hy-price/props.ts +4 -3
- package/components/hy-price/typing.d.ts +8 -4
- package/components/hy-qrcode/hy-qrcode.vue +15 -37
- package/components/hy-qrcode/index.scss +23 -0
- package/components/hy-qrcode/props.ts +2 -2
- package/components/hy-qrcode/typing.d.ts +2 -2
- package/components/hy-radio/hy-radio.vue +2 -101
- package/components/hy-radio/index.scss +93 -0
- package/components/hy-radio/typing.d.ts +1 -2
- package/components/hy-rate/hy-rate.vue +1 -33
- package/components/hy-rate/index.scss +33 -0
- package/components/hy-read-more/hy-read-more.vue +7 -30
- package/components/hy-read-more/index.scss +25 -0
- package/components/hy-read-more/props.ts +3 -3
- package/components/hy-read-more/typing.d.ts +1 -1
- package/components/hy-safe-bottom/hy-safe-bottom.vue +5 -9
- package/components/hy-safe-bottom/index.scss +5 -0
- package/components/hy-scroll-list/hy-scroll-list.vue +13 -43
- package/components/hy-scroll-list/index.scss +34 -0
- package/components/hy-scroll-list/props.ts +2 -2
- package/components/hy-scroll-list/typing.d.ts +1 -1
- package/components/hy-search/hy-search.vue +1 -83
- package/components/hy-search/index.scss +83 -0
- package/components/hy-slider/hy-slider.vue +18 -95
- package/components/hy-slider/index.scss +77 -0
- package/components/hy-status-bar/hy-status-bar.vue +41 -0
- package/components/hy-status-bar/index.scss +6 -0
- package/components/hy-status-bar/props.ts +8 -0
- package/components/hy-status-bar/typing.d.ts +12 -0
- package/components/hy-steps/hy-steps.vue +36 -163
- package/components/hy-steps/index.scss +131 -0
- package/components/hy-steps/props.ts +2 -2
- package/components/hy-steps/typing.d.ts +2 -2
- 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-subsection/hy-subsection.vue +40 -132
- package/components/hy-subsection/index.scss +82 -0
- package/components/hy-subsection/props.ts +1 -0
- package/components/hy-subsection/typing.d.ts +13 -4
- package/components/hy-swipe-action/hy-swipe-action.vue +294 -0
- package/components/hy-swipe-action/index.scss +9 -0
- package/components/hy-swipe-action/index.wxs +235 -0
- package/components/hy-swipe-action/props.ts +16 -0
- package/components/hy-swipe-action/typing.d.ts +55 -0
- package/components/hy-swipe-action/wxs.js +15 -0
- package/components/hy-swiper/hy-swiper-indicator.vue +5 -35
- package/components/hy-swiper/hy-swiper.vue +1 -54
- package/components/hy-swiper/index.scss +82 -0
- package/components/hy-switch/hy-switch.vue +62 -72
- package/components/hy-switch/index.scss +46 -0
- package/components/hy-switch/props.ts +4 -1
- package/components/hy-switch/typing.d.ts +14 -1
- package/components/hy-tabs/hy-tabs.vue +22 -81
- package/components/hy-tabs/index.scss +63 -0
- package/components/hy-tabs/props.ts +5 -5
- package/components/hy-tabs/typing.d.ts +1 -1
- package/components/hy-tag/hy-tag.vue +25 -220
- package/components/hy-tag/index.scss +205 -0
- package/components/hy-text/hy-text.vue +238 -0
- package/components/hy-text/index.scss +70 -0
- package/components/hy-text/index.ts +0 -0
- package/components/hy-text/props.ts +30 -0
- package/components/hy-text/typing.d.ts +98 -0
- package/components/hy-textarea/hy-textarea.vue +1 -46
- package/components/hy-textarea/index.scss +40 -0
- 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-tooltip/hy-tooltip.vue +42 -95
- package/components/hy-tooltip/index.scss +64 -0
- package/components/hy-tooltip/props.ts +2 -2
- package/components/hy-tooltip/typing.d.ts +1 -1
- package/components/hy-transition/hy-transition.vue +4 -2
- package/components/hy-transition/typing.d.ts +1 -13
- package/components/hy-upload/hy-upload.vue +37 -182
- package/components/hy-upload/index.scss +147 -0
- package/components/hy-upload/props.ts +2 -2
- package/components/hy-upload/typing.d.ts +11 -11
- package/components/hy-warn/hy-warn.vue +17 -144
- package/components/hy-warn/index.scss +109 -0
- package/components/hy-warn/props.ts +3 -3
- package/components/hy-warn/typing.d.ts +4 -3
- package/components/hy-waterfall/hy-waterfall.vue +168 -38
- package/components/hy-waterfall/index.scss +16 -0
- package/components/hy-waterfall/props.ts +4 -5
- package/components/hy-waterfall/typing.d.ts +5 -9
- package/components/index.ts +25 -1
- package/components/message/index.ts +54 -54
- package/composables/index.ts +1 -0
- package/composables/useShare.ts +27 -0
- package/config/color.ts +3 -2
- package/config/icon.ts +21 -1
- package/global/index.ts +6 -6
- package/global/register-properties.ts +2 -2
- package/index.scss +2 -1
- package/index.ts +9 -8
- package/libs/css/common.scss +14 -2
- package/package.json +3 -2
- package/{libs/css → public/font}/iconfont.css +4 -4
- package/theme.scss +6 -4
- package/typing/index.ts +1 -1
- package/typing/modules/common.d.ts +36 -1
- package/utils/calendar.js +1021 -0
- package/utils/colorGradient.ts +112 -0
- package/utils/index.ts +2 -0
- package/utils/inside.ts +80 -34
- package/utils/inspect.ts +115 -0
- package/utils/utils.ts +20 -19
- package/libs/css/download.zip +0 -0
- /package/{libs/css → public/font}/iconfont.ttf +0 -0
- /package/{libs/css → public/font}/iconfont.woff +0 -0
- /package/{libs/css → public/font}/iconfont.woff2 +0 -0
|
@@ -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
|
+
}
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
>
|
|
7
7
|
<view ref="hy-subsection__bar" :style="barStyle" :class="barClass"></view>
|
|
8
8
|
<view
|
|
9
|
-
:class="wrapperClass"
|
|
9
|
+
:class="wrapperClass(index)"
|
|
10
10
|
:ref="`hy-subsection__item--${index}`"
|
|
11
11
|
:style="itemStyle"
|
|
12
12
|
@tap="clickHandler(item, index)"
|
|
@@ -21,16 +21,17 @@
|
|
|
21
21
|
</template>
|
|
22
22
|
|
|
23
23
|
<script setup lang="ts">
|
|
24
|
-
import {
|
|
24
|
+
import {computed, toRefs, ref, onMounted, watch, getCurrentInstance} from "vue";
|
|
25
25
|
import type { CSSProperties } from "vue";
|
|
26
26
|
import defaultProps from "./props";
|
|
27
27
|
import type IProps from "./typing";
|
|
28
|
-
import type {
|
|
28
|
+
import type { SubSectionVo } from "./typing";
|
|
29
29
|
import { addUnit, getRect, guid } from "../../utils";
|
|
30
30
|
|
|
31
31
|
const props = withDefaults(defineProps<IProps>(), defaultProps);
|
|
32
32
|
const {
|
|
33
33
|
modelValue,
|
|
34
|
+
current,
|
|
34
35
|
list,
|
|
35
36
|
mode,
|
|
36
37
|
activeColor,
|
|
@@ -42,6 +43,7 @@ const {
|
|
|
42
43
|
} = toRefs(props);
|
|
43
44
|
const emit = defineEmits(["change", "update:modelValue"]);
|
|
44
45
|
|
|
46
|
+
const instance = getCurrentInstance();
|
|
45
47
|
// 组件尺寸
|
|
46
48
|
const itemRect = ref<UniApp.NodeInfo>({
|
|
47
49
|
width: 0,
|
|
@@ -50,12 +52,6 @@ const itemRect = ref<UniApp.NodeInfo>({
|
|
|
50
52
|
const innerCurrent = ref<number>(0);
|
|
51
53
|
const guidClass = guid();
|
|
52
54
|
|
|
53
|
-
watch(
|
|
54
|
-
() => modelValue.value,
|
|
55
|
-
(newVal: string) => {},
|
|
56
|
-
{ immediate: true },
|
|
57
|
-
);
|
|
58
|
-
|
|
59
55
|
/**
|
|
60
56
|
* @description 容器样式
|
|
61
57
|
* */
|
|
@@ -71,15 +67,16 @@ const wrapperStyle = computed<CSSProperties>(() => {
|
|
|
71
67
|
* @description 容器类名
|
|
72
68
|
* */
|
|
73
69
|
const wrapperClass = computed(() => {
|
|
74
|
-
return
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
"hy-subsection__item--no-border-right",
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
70
|
+
return (index: number) => {
|
|
71
|
+
return [
|
|
72
|
+
"hy-subsection__item",
|
|
73
|
+
"cursor-pointer",
|
|
74
|
+
`hy-subsection__item--${innerCurrent.value}__${guidClass}`,
|
|
75
|
+
index < list.value.length - 1 && "hy-subsection__item--no-border-right",
|
|
76
|
+
index === 0 && "hy-subsection__item--first",
|
|
77
|
+
index === list.value.length - 1 && "hy-subsection__item--last",
|
|
78
|
+
];
|
|
79
|
+
};
|
|
83
80
|
});
|
|
84
81
|
/**
|
|
85
82
|
* @description 滑块的样式
|
|
@@ -123,17 +120,15 @@ const barClass = computed(() => {
|
|
|
123
120
|
/**
|
|
124
121
|
* @description 分段器item的样式
|
|
125
122
|
* */
|
|
126
|
-
const itemStyle = computed(() => {
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
return style;
|
|
136
|
-
};
|
|
123
|
+
const itemStyle = computed<CSSProperties>(() => {
|
|
124
|
+
const style: CSSProperties = {};
|
|
125
|
+
if (mode.value === "subsection") {
|
|
126
|
+
// 设置border的样式
|
|
127
|
+
style.borderColor = activeColor.value;
|
|
128
|
+
style.borderWidth = "1px";
|
|
129
|
+
style.borderStyle = "solid";
|
|
130
|
+
}
|
|
131
|
+
return style;
|
|
137
132
|
});
|
|
138
133
|
/**
|
|
139
134
|
* @description 分段器文字颜色
|
|
@@ -164,18 +159,20 @@ onMounted(() => {
|
|
|
164
159
|
* @description 初始化
|
|
165
160
|
* */
|
|
166
161
|
const init = () => {
|
|
167
|
-
innerCurrent.value = list.value.findIndex(
|
|
168
|
-
(item
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
162
|
+
innerCurrent.value = list.value.findIndex((item: SubSectionVo) => {
|
|
163
|
+
if (typeof item === "string" || typeof item === "number") {
|
|
164
|
+
return item === modelValue.value;
|
|
165
|
+
} else {
|
|
166
|
+
return item[fieldNames.value.value] === modelValue.value;
|
|
167
|
+
}
|
|
168
|
+
});
|
|
169
|
+
|
|
170
|
+
// 设置默认值当没有找的时候导致样式问题
|
|
171
|
+
innerCurrent.value =
|
|
172
|
+
innerCurrent.value === -1 ? current.value : innerCurrent.value;
|
|
176
173
|
|
|
177
174
|
// TODO: 多个数组在一起计算宽度, 宽度不一样会有问题,所以必须加guidClass随机数
|
|
178
|
-
getRect(`.hy-subsection__item--0__${guidClass}
|
|
175
|
+
getRect(`.hy-subsection__item--0__${guidClass}`, false, instance).then((size) => {
|
|
179
176
|
itemRect.value = size as UniApp.NodeInfo;
|
|
180
177
|
});
|
|
181
178
|
};
|
|
@@ -183,21 +180,21 @@ const init = () => {
|
|
|
183
180
|
/**
|
|
184
181
|
* @description 判断值
|
|
185
182
|
* */
|
|
186
|
-
const getValue = (item:
|
|
183
|
+
const getValue = (item: SubSectionVo) => {
|
|
187
184
|
return typeof item === "object" ? item[fieldNames.value.value] : item;
|
|
188
185
|
};
|
|
189
186
|
|
|
190
187
|
/**
|
|
191
188
|
* @description 判断展示文本
|
|
192
189
|
* */
|
|
193
|
-
const getName = (item:
|
|
190
|
+
const getName = (item: SubSectionVo) => {
|
|
194
191
|
return typeof item === "object" ? item[fieldNames.value.label] : item;
|
|
195
192
|
};
|
|
196
193
|
|
|
197
194
|
/**
|
|
198
195
|
* @description 点击事件
|
|
199
196
|
* */
|
|
200
|
-
const clickHandler = (temp:
|
|
197
|
+
const clickHandler = (temp: SubSectionVo, index: number) => {
|
|
201
198
|
// 值改变才触发
|
|
202
199
|
if (innerCurrent.value !== index) {
|
|
203
200
|
emit("change", index);
|
|
@@ -208,94 +205,5 @@ const clickHandler = (temp: string | SubSectionListVo, index: number) => {
|
|
|
208
205
|
</script>
|
|
209
206
|
|
|
210
207
|
<style lang="scss" scoped>
|
|
211
|
-
@import "
|
|
212
|
-
|
|
213
|
-
.hy-subsection {
|
|
214
|
-
@include flex;
|
|
215
|
-
position: relative;
|
|
216
|
-
overflow: hidden;
|
|
217
|
-
/* #ifndef APP-NVUE */
|
|
218
|
-
width: 100%;
|
|
219
|
-
box-sizing: border-box;
|
|
220
|
-
/* #endif */
|
|
221
|
-
|
|
222
|
-
&--button {
|
|
223
|
-
height: 35px;
|
|
224
|
-
background-color: rgb(238, 238, 239);
|
|
225
|
-
padding: 3px;
|
|
226
|
-
border-radius: 4px;
|
|
227
|
-
align-items: stretch;
|
|
228
|
-
|
|
229
|
-
&__bar {
|
|
230
|
-
background-color: #ffffff;
|
|
231
|
-
border-radius: 4px !important;
|
|
232
|
-
}
|
|
233
|
-
}
|
|
234
|
-
|
|
235
|
-
&--subsection {
|
|
236
|
-
height: 32px;
|
|
237
|
-
}
|
|
238
|
-
|
|
239
|
-
&__bar {
|
|
240
|
-
position: absolute;
|
|
241
|
-
/* #ifndef APP-NVUE */
|
|
242
|
-
transition-property: transform, color;
|
|
243
|
-
transition-duration: 0.3s;
|
|
244
|
-
transition-timing-function: ease-in-out;
|
|
245
|
-
/* #endif */
|
|
246
|
-
|
|
247
|
-
&--first {
|
|
248
|
-
border-top-left-radius: 4px;
|
|
249
|
-
border-bottom-left-radius: 4px;
|
|
250
|
-
border-top-right-radius: 0px;
|
|
251
|
-
border-bottom-right-radius: 0px;
|
|
252
|
-
}
|
|
253
|
-
|
|
254
|
-
&--center {
|
|
255
|
-
border-top-left-radius: 0px;
|
|
256
|
-
border-bottom-left-radius: 0px;
|
|
257
|
-
border-top-right-radius: 0px;
|
|
258
|
-
border-bottom-right-radius: 0px;
|
|
259
|
-
}
|
|
260
|
-
|
|
261
|
-
&--last {
|
|
262
|
-
border-top-left-radius: 0px;
|
|
263
|
-
border-bottom-left-radius: 0px;
|
|
264
|
-
border-top-right-radius: 4px;
|
|
265
|
-
border-bottom-right-radius: 4px;
|
|
266
|
-
}
|
|
267
|
-
}
|
|
268
|
-
|
|
269
|
-
&__item {
|
|
270
|
-
@include flex;
|
|
271
|
-
flex: 1;
|
|
272
|
-
justify-content: center;
|
|
273
|
-
align-items: center;
|
|
274
|
-
// vue环境下,需要设置相对定位,因为滑块为绝对定位,item需要在滑块的上面
|
|
275
|
-
position: relative;
|
|
276
|
-
|
|
277
|
-
&--no-border-right {
|
|
278
|
-
border-right-width: 0 !important;
|
|
279
|
-
}
|
|
280
|
-
|
|
281
|
-
&--first {
|
|
282
|
-
border-top-left-radius: 4px;
|
|
283
|
-
border-bottom-left-radius: 4px;
|
|
284
|
-
}
|
|
285
|
-
|
|
286
|
-
&--last {
|
|
287
|
-
border-top-right-radius: 4px;
|
|
288
|
-
border-bottom-right-radius: 4px;
|
|
289
|
-
}
|
|
290
|
-
|
|
291
|
-
&__text {
|
|
292
|
-
font-size: 12px;
|
|
293
|
-
line-height: 14px;
|
|
294
|
-
@include flex;
|
|
295
|
-
align-items: center;
|
|
296
|
-
transition-property: color;
|
|
297
|
-
transition-duration: 0.3s;
|
|
298
|
-
}
|
|
299
|
-
}
|
|
300
|
-
}
|
|
208
|
+
@import "./index.scss";
|
|
301
209
|
</style>
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
@use "../../theme.scss" as *;
|
|
2
|
+
@use "../../libs/css/mixin.scss" as *;
|
|
3
|
+
|
|
4
|
+
.hy-subsection {
|
|
5
|
+
@include flex;
|
|
6
|
+
position: relative;
|
|
7
|
+
overflow: hidden;
|
|
8
|
+
/* #ifndef APP-NVUE */
|
|
9
|
+
width: 100%;
|
|
10
|
+
box-sizing: border-box;
|
|
11
|
+
/* #endif */
|
|
12
|
+
|
|
13
|
+
&--button {
|
|
14
|
+
height: 35px;
|
|
15
|
+
background-color: rgb(238, 238, 239);
|
|
16
|
+
padding: 3px;
|
|
17
|
+
border-radius: $hy-border-radius-sm;
|
|
18
|
+
align-items: stretch;
|
|
19
|
+
|
|
20
|
+
&__bar {
|
|
21
|
+
background-color: #ffffff;
|
|
22
|
+
border-radius: $hy-border-radius-sm;
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
&--subsection {
|
|
27
|
+
height: 32px;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
&__bar {
|
|
31
|
+
position: absolute;
|
|
32
|
+
/* #ifndef APP-NVUE */
|
|
33
|
+
transition-property: transform, color;
|
|
34
|
+
transition-duration: 0.3s;
|
|
35
|
+
transition-timing-function: ease-in-out;
|
|
36
|
+
/* #endif */
|
|
37
|
+
|
|
38
|
+
&--first {
|
|
39
|
+
border-radius: $hy-border-radius-sm 0 0 $hy-border-radius-sm;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
&--center {
|
|
43
|
+
border-radius: 0;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
&--last {
|
|
47
|
+
border-radius: 0 $hy-border-radius-sm $hy-border-radius-sm 0;
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
&__item {
|
|
52
|
+
@include flex;
|
|
53
|
+
flex: 1;
|
|
54
|
+
justify-content: center;
|
|
55
|
+
align-items: center;
|
|
56
|
+
// vue环境下,需要设置相对定位,因为滑块为绝对定位,item需要在滑块的上面
|
|
57
|
+
position: relative;
|
|
58
|
+
|
|
59
|
+
&--no-border-right {
|
|
60
|
+
border-right-width: 0 !important;
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
&--first {
|
|
64
|
+
border-top-left-radius: $hy-border-radius-sm;
|
|
65
|
+
border-bottom-left-radius: $hy-border-radius-sm;
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
&--last {
|
|
69
|
+
border-top-right-radius: $hy-border-radius-sm;
|
|
70
|
+
border-bottom-right-radius: $hy-border-radius-sm;
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
&__text {
|
|
74
|
+
font-size: 12px;
|
|
75
|
+
line-height: 14px;
|
|
76
|
+
@include flex;
|
|
77
|
+
align-items: center;
|
|
78
|
+
transition-property: color;
|
|
79
|
+
transition-duration: 0.3s;
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
}
|
|
@@ -1,17 +1,26 @@
|
|
|
1
1
|
import type { CSSProperties } from "vue";
|
|
2
2
|
import { HyApp } from "@/package/typing/modules/common";
|
|
3
3
|
|
|
4
|
-
export interface
|
|
4
|
+
export interface SubSectionItemVo extends HyApp.FieldNamesType {
|
|
5
5
|
name: string;
|
|
6
|
-
value: string;
|
|
6
|
+
value: string | number;
|
|
7
7
|
}
|
|
8
8
|
|
|
9
|
+
export type SubSectionVo = string | number | SubSectionItemVo;
|
|
10
|
+
|
|
9
11
|
export default interface IProps {
|
|
10
|
-
|
|
12
|
+
/**
|
|
13
|
+
* @description 接收值
|
|
14
|
+
* */
|
|
15
|
+
modelValue: string | number;
|
|
16
|
+
/**
|
|
17
|
+
* @description 默认值 (默认0)
|
|
18
|
+
* */
|
|
19
|
+
current?: number;
|
|
11
20
|
/**
|
|
12
21
|
* @description tab的数据
|
|
13
22
|
* */
|
|
14
|
-
list:
|
|
23
|
+
list: SubSectionVo[];
|
|
15
24
|
/**
|
|
16
25
|
* @description list的键值
|
|
17
26
|
* */
|