hy-app 0.2.2 → 0.2.5
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 +88 -120
- package/components/hy-button/index.scss +1 -3
- package/components/hy-calendar/index.scss +1 -1
- package/components/hy-cell/index.scss +2 -17
- package/components/hy-checkbox/index.scss +10 -10
- package/components/hy-code-input/hy-code-input.vue +85 -74
- package/components/hy-code-input/index.scss +31 -1
- package/components/hy-code-input/props.ts +8 -7
- package/components/hy-code-input/typing.d.ts +22 -18
- package/components/hy-config-provider/props.ts +1 -1
- package/components/hy-config-provider/typing.d.ts +7 -7
- package/components/hy-dropdown-item/hy-dropdown-item.vue +69 -75
- package/components/hy-dropdown-item/index.scss +1 -1
- package/components/hy-float-button/hy-float-button.vue +69 -86
- package/components/hy-form/index.scss +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-navbar/index.scss +2 -2
- package/components/hy-notice-bar/index.scss +3 -3
- package/components/hy-notify/typing.d.ts +1 -1
- package/components/hy-pagination/typing.d.ts +1 -1
- package/components/hy-picker/hy-picker.vue +9 -8
- package/components/hy-picker/index.scss +6 -2
- package/components/hy-radio/index.scss +2 -2
- package/components/hy-scroll-list/index.scss +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/hy-text.vue +76 -87
- package/components/hy-text/index.scss +8 -8
- package/components/hy-upload/index.scss +0 -1
- package/components/hy-watermark/hy-watermark.vue +583 -0
- package/components/hy-watermark/index.scss +17 -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.scss +1 -1
- package/index.ts +1 -1
- package/libs/css/common.scss +9 -1
- package/libs/css/vars.css +5 -1
- package/package.json +2 -2
- package/theme.scss +8 -18
- 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,14 +1,12 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<!-- 标题栏 -->
|
|
3
|
-
<view
|
|
4
|
-
:class="['hy-dropdown-item__header', isOpen && 'is-active']"
|
|
5
|
-
@click="handleClick"
|
|
6
|
-
>
|
|
3
|
+
<view :class="['hy-dropdown-item__header', isOpen && 'is-active']" @click="handleClick">
|
|
7
4
|
<text
|
|
8
5
|
class="hy-dropdown-item__header--title"
|
|
9
6
|
:style="{ color: currentColor, fontSize: addUnit(titleSize) }"
|
|
10
|
-
>{{ title }}</text
|
|
11
7
|
>
|
|
8
|
+
{{ title }}
|
|
9
|
+
</text>
|
|
12
10
|
<HyIcon
|
|
13
11
|
:custom-style="{
|
|
14
12
|
transform: isOpen ? 'rotate(-180deg)' : 'rotate(0deg)',
|
|
@@ -19,11 +17,7 @@
|
|
|
19
17
|
></HyIcon>
|
|
20
18
|
</view>
|
|
21
19
|
<!-- 下拉弹窗 -->
|
|
22
|
-
<HyOverlay
|
|
23
|
-
:show="isOpen"
|
|
24
|
-
:custom-style="{ top: addUnit(dropPopupTop) }"
|
|
25
|
-
@click="closePopupFn"
|
|
26
|
-
>
|
|
20
|
+
<HyOverlay :show="isOpen" :custom-style="{ top: addUnit(dropPopupTop) }" @click="closePopupFn">
|
|
27
21
|
<view
|
|
28
22
|
class="hy-dropdown-item__main"
|
|
29
23
|
:style="{ top: addUnit(dropPopupTop), height: addUnit(dropHeight) }"
|
|
@@ -47,8 +41,9 @@
|
|
|
47
41
|
:style="{
|
|
48
42
|
color: currentIndex === index ? currentColor : inactiveColor,
|
|
49
43
|
}"
|
|
50
|
-
>{{ item.label }}</view
|
|
51
44
|
>
|
|
45
|
+
{{ item.label }}
|
|
46
|
+
</view>
|
|
52
47
|
<!-- 勾选图标 -->
|
|
53
48
|
<HyIcon
|
|
54
49
|
v-if="currentIndex === index"
|
|
@@ -62,91 +57,90 @@
|
|
|
62
57
|
</HyOverlay>
|
|
63
58
|
</template>
|
|
64
59
|
|
|
60
|
+
<script lang="ts">
|
|
61
|
+
export default {
|
|
62
|
+
name: 'hy-dropdown-item',
|
|
63
|
+
options: {
|
|
64
|
+
styleIsolation: 'shared',
|
|
65
|
+
},
|
|
66
|
+
}
|
|
67
|
+
</script>
|
|
68
|
+
|
|
65
69
|
<script setup lang="ts">
|
|
66
|
-
import {
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
toRefs,
|
|
74
|
-
getCurrentInstance,
|
|
75
|
-
} from "vue";
|
|
76
|
-
import defaultProps from "./props";
|
|
77
|
-
import type IProps from "./typing";
|
|
78
|
-
import type FatherIProps from "../hy-dropdown/typing";
|
|
79
|
-
import type { DropdownMenuItem } from "./typing";
|
|
80
|
-
import { addUnit, getRect, throttle } from "../../utils";
|
|
81
|
-
import { IconConfig } from "../../config";
|
|
70
|
+
import { computed, inject, ref, onMounted, watch, useSlots, toRefs, getCurrentInstance } from 'vue'
|
|
71
|
+
import defaultProps from './props'
|
|
72
|
+
import type IProps from './typing'
|
|
73
|
+
import type FatherIProps from '../hy-dropdown/typing'
|
|
74
|
+
import type { DropdownMenuItem } from './typing'
|
|
75
|
+
import { addUnit, getRect, throttle } from '../../utils'
|
|
76
|
+
import { IconConfig } from '../../config'
|
|
82
77
|
|
|
83
|
-
import HyOverlay from
|
|
84
|
-
import HyIcon from
|
|
78
|
+
import HyOverlay from '../hy-overlay/hy-overlay.vue'
|
|
79
|
+
import HyIcon from '../hy-icon/hy-icon.vue'
|
|
85
80
|
|
|
86
|
-
const props = withDefaults(defineProps<IProps>(), defaultProps)
|
|
87
|
-
const { modelValue, menus } = toRefs(props)
|
|
88
|
-
const emits = defineEmits([
|
|
81
|
+
const props = withDefaults(defineProps<IProps>(), defaultProps)
|
|
82
|
+
const { modelValue, menus } = toRefs(props)
|
|
83
|
+
const emits = defineEmits(['update:modelValue', 'change'])
|
|
89
84
|
|
|
90
|
-
const slots = useSlots()
|
|
85
|
+
const slots = useSlots()
|
|
91
86
|
//是否有插槽
|
|
92
87
|
const hasSlot = computed(() => {
|
|
93
|
-
return Object.keys(slots).length > 0
|
|
94
|
-
})
|
|
95
|
-
const instance = getCurrentInstance()
|
|
88
|
+
return Object.keys(slots).length > 0
|
|
89
|
+
})
|
|
90
|
+
const instance = getCurrentInstance()
|
|
96
91
|
//父的props值
|
|
97
|
-
const dropdownProps: FatherIProps | undefined = inject(
|
|
98
|
-
const { titleSize, menuIcon, menuIconSize, inactiveColor } =
|
|
99
|
-
dropdownProps as FatherIProps;
|
|
92
|
+
const dropdownProps: FatherIProps | undefined = inject('dropdownProps')
|
|
93
|
+
const { titleSize, menuIcon, menuIconSize, inactiveColor } = dropdownProps as FatherIProps
|
|
100
94
|
//当前打开的dropItem项(标签名)
|
|
101
|
-
const currentDropItem: any = inject(
|
|
95
|
+
const currentDropItem: any = inject('currentDropItem')
|
|
102
96
|
//当前文字/箭头颜色
|
|
103
97
|
const currentColor = computed(() => {
|
|
104
|
-
return isOpen.value ? dropdownProps?.activeColor : inactiveColor
|
|
105
|
-
})
|
|
98
|
+
return isOpen.value ? dropdownProps?.activeColor : inactiveColor
|
|
99
|
+
})
|
|
106
100
|
//是否打开
|
|
107
|
-
const isOpen = ref<boolean>(false)
|
|
101
|
+
const isOpen = ref<boolean>(false)
|
|
108
102
|
//下拉弹窗距离页面顶部距离
|
|
109
|
-
const dropPopupTop = ref(0)
|
|
103
|
+
const dropPopupTop = ref(0)
|
|
110
104
|
//下拉弹窗高度
|
|
111
|
-
const dropHeight = ref<string | number>(0)
|
|
105
|
+
const dropHeight = ref<string | number>(0)
|
|
112
106
|
//下拉选项当前选中的索引
|
|
113
|
-
const currentIndex = ref(-1)
|
|
107
|
+
const currentIndex = ref(-1)
|
|
114
108
|
|
|
115
109
|
//动态class
|
|
116
|
-
const customClass = computed(() => (isOpen.value ?
|
|
110
|
+
const customClass = computed(() => (isOpen.value ? 'visible' : 'hidden'))
|
|
117
111
|
|
|
118
112
|
onMounted(() => {
|
|
119
|
-
getDropPopupTop()
|
|
120
|
-
})
|
|
113
|
+
getDropPopupTop()
|
|
114
|
+
})
|
|
121
115
|
|
|
122
116
|
/**
|
|
123
117
|
* @description 计算下拉弹窗区域距离页面顶部距离
|
|
124
118
|
* */
|
|
125
119
|
const getDropPopupTop = () => {
|
|
126
|
-
getRect(
|
|
127
|
-
const { bottom } = rect as UniApp.NodeInfo
|
|
120
|
+
getRect('.hy-dropdown-item__header', false, instance).then((rect) => {
|
|
121
|
+
const { bottom } = rect as UniApp.NodeInfo
|
|
128
122
|
// #ifdef H5
|
|
129
123
|
//H5需要加上导航栏高度,固定44px
|
|
130
|
-
dropPopupTop.value = (bottom || 0) + 44
|
|
124
|
+
dropPopupTop.value = (bottom || 0) + 44
|
|
131
125
|
// #endif
|
|
132
126
|
// #ifndef H5
|
|
133
|
-
dropPopupTop.value = bottom || 0
|
|
127
|
+
dropPopupTop.value = bottom || 0
|
|
134
128
|
// #endif
|
|
135
|
-
})
|
|
136
|
-
}
|
|
129
|
+
})
|
|
130
|
+
}
|
|
137
131
|
|
|
138
132
|
watch(isOpen, (v) => {
|
|
139
133
|
//打开状态显示父容器
|
|
140
134
|
if (v) {
|
|
141
|
-
dropHeight.value =
|
|
135
|
+
dropHeight.value = 'auto'
|
|
142
136
|
} else {
|
|
143
137
|
//关闭状态隐藏父容器
|
|
144
138
|
//延迟改变使得关闭动画能完整呈现
|
|
145
139
|
setTimeout(() => {
|
|
146
|
-
dropHeight.value = 0
|
|
147
|
-
}, 200)
|
|
140
|
+
dropHeight.value = 0
|
|
141
|
+
}, 200)
|
|
148
142
|
}
|
|
149
|
-
})
|
|
143
|
+
})
|
|
150
144
|
/**
|
|
151
145
|
* @description 动态控制开关,
|
|
152
146
|
* @desc 防止点击展开后在点击下一个,导致上一个没有关闭bug
|
|
@@ -156,29 +150,29 @@ watch(
|
|
|
156
150
|
(newVal) => {
|
|
157
151
|
//关闭其他条件的下拉弹窗
|
|
158
152
|
if (newVal !== props.title) {
|
|
159
|
-
isOpen.value = false
|
|
153
|
+
isOpen.value = false
|
|
160
154
|
}
|
|
161
155
|
},
|
|
162
|
-
)
|
|
156
|
+
)
|
|
163
157
|
|
|
164
158
|
//根据双向绑定值动态设置下拉选中项索引
|
|
165
159
|
watch(
|
|
166
160
|
() => modelValue.value,
|
|
167
161
|
(newVal) => {
|
|
168
|
-
currentIndex.value = menus.value.findIndex((item) => item.value === newVal)
|
|
162
|
+
currentIndex.value = menus.value.findIndex((item) => item.value === newVal)
|
|
169
163
|
},
|
|
170
164
|
{ immediate: true },
|
|
171
|
-
)
|
|
165
|
+
)
|
|
172
166
|
|
|
173
167
|
//选中监听
|
|
174
168
|
const onSelect = (item: DropdownMenuItem, index: number) => {
|
|
175
|
-
isOpen.value = false
|
|
169
|
+
isOpen.value = false
|
|
176
170
|
if (index !== currentIndex.value) {
|
|
177
|
-
currentIndex.value = index
|
|
178
|
-
emits(
|
|
179
|
-
emits(
|
|
171
|
+
currentIndex.value = index
|
|
172
|
+
emits('update:modelValue', item.value)
|
|
173
|
+
emits('change', item.value)
|
|
180
174
|
}
|
|
181
|
-
}
|
|
175
|
+
}
|
|
182
176
|
|
|
183
177
|
/**
|
|
184
178
|
* @description 打开或关闭
|
|
@@ -186,24 +180,24 @@ const onSelect = (item: DropdownMenuItem, index: number) => {
|
|
|
186
180
|
const handleClick = () =>
|
|
187
181
|
throttle(() => {
|
|
188
182
|
//节流处理,防止点击过快动画未结束又切换导致显示bug
|
|
189
|
-
isOpen.value = !isOpen.value
|
|
183
|
+
isOpen.value = !isOpen.value
|
|
190
184
|
if (isOpen.value) {
|
|
191
185
|
// 防止点击展开后在点击下一个,导致上一个没有关闭bug
|
|
192
|
-
currentDropItem.value = props.title
|
|
193
|
-
getDropPopupTop()
|
|
186
|
+
currentDropItem.value = props.title
|
|
187
|
+
getDropPopupTop()
|
|
194
188
|
}
|
|
195
|
-
})
|
|
189
|
+
})
|
|
196
190
|
|
|
197
191
|
/**
|
|
198
192
|
* @description 点击遮罩框关闭弹窗
|
|
199
193
|
* */
|
|
200
194
|
const closePopupFn = () => {
|
|
201
195
|
if (dropdownProps?.closeOnClickMask) {
|
|
202
|
-
isOpen.value = false
|
|
196
|
+
isOpen.value = false
|
|
203
197
|
}
|
|
204
|
-
}
|
|
198
|
+
}
|
|
205
199
|
</script>
|
|
206
200
|
|
|
207
201
|
<style lang="scss" scoped>
|
|
208
|
-
@import
|
|
202
|
+
@import './index.scss';
|
|
209
203
|
</style>
|
|
@@ -22,9 +22,7 @@
|
|
|
22
22
|
:color="iconColor"
|
|
23
23
|
:size="iconSize ? iconSize : addUnit(getPx(getFloatBtnSize) * 0.7)"
|
|
24
24
|
/>
|
|
25
|
-
<text v-if="text" :style="{ color: textColor, fontSize: fontSize }">{{
|
|
26
|
-
text
|
|
27
|
-
}}</text>
|
|
25
|
+
<text v-if="text" :style="{ color: textColor, fontSize: fontSize }">{{ text }}</text>
|
|
28
26
|
</slot>
|
|
29
27
|
</view>
|
|
30
28
|
|
|
@@ -43,10 +41,11 @@
|
|
|
43
41
|
}"
|
|
44
42
|
@click="handleMenuItemClick(item, i)"
|
|
45
43
|
>
|
|
46
|
-
{{ typeof item ===
|
|
44
|
+
{{ typeof item === 'string' ? item : item.label }}
|
|
47
45
|
</view>
|
|
48
46
|
<HyLine
|
|
49
47
|
v-if="i !== menus.length - 1"
|
|
48
|
+
color="#FFFFFF"
|
|
50
49
|
:length="addUnit(getPx(getFloatBtnSize) * 0.7)"
|
|
51
50
|
:direction="direction === 'row' ? 'column' : 'row'"
|
|
52
51
|
:custom-style="{ margin: 'auto' }"
|
|
@@ -63,30 +62,23 @@ export default {
|
|
|
63
62
|
options: {
|
|
64
63
|
addGlobalClass: true,
|
|
65
64
|
virtualHost: true,
|
|
66
|
-
styleIsolation: 'shared'
|
|
67
|
-
}
|
|
65
|
+
styleIsolation: 'shared',
|
|
66
|
+
},
|
|
68
67
|
}
|
|
69
68
|
</script>
|
|
70
69
|
|
|
71
70
|
<script lang="ts" setup>
|
|
72
|
-
import {
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
ref,
|
|
78
|
-
toRefs,
|
|
79
|
-
} from "vue";
|
|
80
|
-
import type IProps from "./typing";
|
|
81
|
-
import type { MenusType } from "./typing";
|
|
82
|
-
import defaultProps from "./props";
|
|
83
|
-
import { addUnit, getPx, getRect, getWindowInfo, guid } from "../../utils";
|
|
71
|
+
import { computed, type CSSProperties, getCurrentInstance, onMounted, ref, toRefs } from 'vue'
|
|
72
|
+
import type IProps from './typing'
|
|
73
|
+
import type { MenusType } from './typing'
|
|
74
|
+
import defaultProps from './props'
|
|
75
|
+
import { addUnit, getPx, getRect, getWindowInfo, guid } from '../../utils'
|
|
84
76
|
|
|
85
77
|
// 组件
|
|
86
|
-
import HyIcon from
|
|
87
|
-
import HyLine from
|
|
78
|
+
import HyIcon from '../hy-icon/hy-icon.vue'
|
|
79
|
+
import HyLine from '../hy-line/hy-line.vue'
|
|
88
80
|
|
|
89
|
-
const props = withDefaults(defineProps<IProps>(), defaultProps)
|
|
81
|
+
const props = withDefaults(defineProps<IProps>(), defaultProps)
|
|
90
82
|
const {
|
|
91
83
|
menus,
|
|
92
84
|
customStyle,
|
|
@@ -99,33 +91,30 @@ const {
|
|
|
99
91
|
size,
|
|
100
92
|
fixed,
|
|
101
93
|
direction,
|
|
102
|
-
} = toRefs(props)
|
|
103
|
-
const emit = defineEmits([
|
|
94
|
+
} = toRefs(props)
|
|
95
|
+
const emit = defineEmits(['click', 'clickItem'])
|
|
104
96
|
|
|
105
|
-
const instance = getCurrentInstance()
|
|
97
|
+
const instance = getCurrentInstance()
|
|
106
98
|
const btnSize: AnyObject = {
|
|
107
|
-
small:
|
|
108
|
-
medium:
|
|
109
|
-
large:
|
|
110
|
-
}
|
|
111
|
-
const open = ref(false)
|
|
112
|
-
const rotate = computed(() => (open.value && !text.value ?
|
|
113
|
-
const soleId = `hy-float-button__${guid()}
|
|
114
|
-
const showLeft = ref(false)
|
|
99
|
+
small: '50px',
|
|
100
|
+
medium: '60px',
|
|
101
|
+
large: '70px',
|
|
102
|
+
}
|
|
103
|
+
const open = ref(false)
|
|
104
|
+
const rotate = computed(() => (open.value && !text.value ? '45deg' : '0deg'))
|
|
105
|
+
const soleId = `hy-float-button__${guid()}`
|
|
106
|
+
const showLeft = ref(false)
|
|
115
107
|
|
|
116
108
|
/**
|
|
117
109
|
* @description 获取组件大小
|
|
118
110
|
* */
|
|
119
111
|
const getFloatBtnSize = computed(() => {
|
|
120
|
-
if (
|
|
121
|
-
|
|
122
|
-
Object.keys(btnSize).includes(size.value)
|
|
123
|
-
) {
|
|
124
|
-
return btnSize[size.value];
|
|
112
|
+
if (typeof size.value === 'string' && Object.keys(btnSize).includes(size.value)) {
|
|
113
|
+
return btnSize[size.value]
|
|
125
114
|
} else {
|
|
126
|
-
return addUnit(size.value)
|
|
115
|
+
return addUnit(size.value)
|
|
127
116
|
}
|
|
128
|
-
})
|
|
117
|
+
})
|
|
129
118
|
|
|
130
119
|
/**
|
|
131
120
|
* @description 悬浮按钮样式
|
|
@@ -137,85 +126,79 @@ const FloatButtonStyle = computed(() => {
|
|
|
137
126
|
backgroundColor: bgColor.value,
|
|
138
127
|
zIndex: zIndex.value,
|
|
139
128
|
color: textColor.value,
|
|
140
|
-
}
|
|
141
|
-
if (fixed.value) style.position =
|
|
129
|
+
}
|
|
130
|
+
if (fixed.value) style.position = 'fixed'
|
|
142
131
|
|
|
143
|
-
style.height = getFloatBtnSize.value
|
|
144
|
-
style.width = getFloatBtnSize.value
|
|
145
|
-
return Object.assign(style, customStyle.value)
|
|
146
|
-
})
|
|
132
|
+
style.height = getFloatBtnSize.value
|
|
133
|
+
style.width = getFloatBtnSize.value
|
|
134
|
+
return Object.assign(style, customStyle.value)
|
|
135
|
+
})
|
|
147
136
|
const menusStyle = computed(() => {
|
|
148
137
|
const style: CSSProperties = {
|
|
149
138
|
backgroundColor: bgColor.value,
|
|
150
|
-
}
|
|
139
|
+
}
|
|
151
140
|
|
|
152
141
|
// 判断横向展示还是纵向展示
|
|
153
|
-
if (direction.value ===
|
|
142
|
+
if (direction.value === 'row') {
|
|
154
143
|
if (showLeft.value) {
|
|
155
|
-
style.transform =
|
|
156
|
-
style.left =
|
|
157
|
-
style.paddingRight = getFloatBtnSize.value
|
|
158
|
-
style.flexDirection =
|
|
144
|
+
style.transform = 'translateX(-100%)'
|
|
145
|
+
style.left = '100%'
|
|
146
|
+
style.paddingRight = getFloatBtnSize.value
|
|
147
|
+
style.flexDirection = 'row-reverse'
|
|
159
148
|
} else {
|
|
160
|
-
style.paddingLeft = getFloatBtnSize.value
|
|
149
|
+
style.paddingLeft = getFloatBtnSize.value
|
|
161
150
|
}
|
|
162
|
-
style.bottom = 0
|
|
163
|
-
style.transition =
|
|
164
|
-
style.height = getFloatBtnSize.value
|
|
151
|
+
style.bottom = 0
|
|
152
|
+
style.transition = 'width 0.5s ease'
|
|
153
|
+
style.height = getFloatBtnSize.value
|
|
165
154
|
style.width = open.value
|
|
166
|
-
? addUnit(
|
|
167
|
-
|
|
168
|
-
getPx(getFloatBtnSize.value),
|
|
169
|
-
)
|
|
170
|
-
: 0;
|
|
155
|
+
? addUnit(getPx(getFloatBtnSize.value) * menus.value.length + getPx(getFloatBtnSize.value))
|
|
156
|
+
: 0
|
|
171
157
|
} else {
|
|
172
|
-
style.bottom = 0
|
|
173
|
-
style.left = 0
|
|
174
|
-
style.transition =
|
|
175
|
-
style.width = getFloatBtnSize.value
|
|
158
|
+
style.bottom = 0
|
|
159
|
+
style.left = 0
|
|
160
|
+
style.transition = 'height 0.5s ease'
|
|
161
|
+
style.width = getFloatBtnSize.value
|
|
176
162
|
style.height = open.value
|
|
177
|
-
? addUnit(
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
)
|
|
181
|
-
: 0;
|
|
182
|
-
style.paddingBottom = getFloatBtnSize.value;
|
|
163
|
+
? addUnit(getPx(getFloatBtnSize.value) * menus.value.length + getPx(getFloatBtnSize.value))
|
|
164
|
+
: 0
|
|
165
|
+
style.paddingBottom = getFloatBtnSize.value
|
|
183
166
|
}
|
|
184
|
-
return style
|
|
185
|
-
})
|
|
167
|
+
return style
|
|
168
|
+
})
|
|
186
169
|
|
|
187
170
|
onMounted(() => {
|
|
188
|
-
const { windowWidth } = getWindowInfo()
|
|
171
|
+
const { windowWidth } = getWindowInfo()
|
|
189
172
|
getRect(`#${soleId}`, false, instance).then((rect) => {
|
|
190
|
-
const { left } = rect as UniApp.NodeInfo
|
|
191
|
-
if (left && left > windowWidth / 2) showLeft.value = true
|
|
192
|
-
})
|
|
193
|
-
})
|
|
173
|
+
const { left } = rect as UniApp.NodeInfo
|
|
174
|
+
if (left && left > windowWidth / 2) showLeft.value = true
|
|
175
|
+
})
|
|
176
|
+
})
|
|
194
177
|
|
|
195
178
|
/**
|
|
196
179
|
* @description 点击悬浮按钮
|
|
197
180
|
* */
|
|
198
181
|
const handleClick = () => {
|
|
199
|
-
emit(
|
|
200
|
-
open.value = !open.value
|
|
201
|
-
}
|
|
182
|
+
emit('click')
|
|
183
|
+
open.value = !open.value
|
|
184
|
+
}
|
|
202
185
|
|
|
203
186
|
/**
|
|
204
187
|
* @description 点击单条菜单栏
|
|
205
188
|
* */
|
|
206
189
|
const handleMenuItemClick = (temp: MenusType, index: number) => {
|
|
207
|
-
emit(
|
|
208
|
-
open.value = false
|
|
209
|
-
if (typeof temp !==
|
|
190
|
+
emit('clickItem', temp, index)
|
|
191
|
+
open.value = false
|
|
192
|
+
if (typeof temp !== 'string' && temp?.url) {
|
|
210
193
|
uni.navigateTo({
|
|
211
194
|
url: temp.url,
|
|
212
|
-
})
|
|
195
|
+
})
|
|
213
196
|
}
|
|
214
|
-
}
|
|
197
|
+
}
|
|
215
198
|
</script>
|
|
216
199
|
|
|
217
200
|
<style scoped lang="scss">
|
|
218
|
-
@import
|
|
201
|
+
@import './index.scss';
|
|
219
202
|
.hy-float-button {
|
|
220
203
|
&__container {
|
|
221
204
|
rotate: v-bind(rotate);
|
|
@@ -10,9 +10,9 @@
|
|
|
10
10
|
>
|
|
11
11
|
<slot :record="item">
|
|
12
12
|
<HyIcon
|
|
13
|
-
:name="item?.icon"
|
|
13
|
+
:name="item[customKeys?.icon]"
|
|
14
14
|
label-pos="bottom"
|
|
15
|
-
:label="item?.name"
|
|
15
|
+
:label="item[customKeys?.name]"
|
|
16
16
|
:space="item?.iconConfig?.space || iconConfig?.space || 8"
|
|
17
17
|
:color="item?.iconConfig?.color || iconConfig?.color"
|
|
18
18
|
:size="item?.iconConfig?.size || iconConfig?.size || 30"
|
|
@@ -28,7 +28,6 @@
|
|
|
28
28
|
item?.iconConfig?.customStyle || iconConfig?.customStyle
|
|
29
29
|
"
|
|
30
30
|
></HyIcon>
|
|
31
|
-
<!-- <view class="hy-grid-item__title">{{ item.name }}</view>-->
|
|
32
31
|
</slot>
|
|
33
32
|
</view>
|
|
34
33
|
</template>
|
|
@@ -19,11 +19,26 @@ interface GridItemVo {
|
|
|
19
19
|
* */
|
|
20
20
|
[key: string]: any;
|
|
21
21
|
}
|
|
22
|
+
export interface CustomKeysVo {
|
|
23
|
+
/**
|
|
24
|
+
* @description 自定义标题键名
|
|
25
|
+
* */
|
|
26
|
+
name: string;
|
|
27
|
+
/**
|
|
28
|
+
* @description 自定义icon键名
|
|
29
|
+
* */
|
|
30
|
+
icon: string;
|
|
31
|
+
}
|
|
32
|
+
|
|
22
33
|
export default interface HyGridProps {
|
|
23
34
|
/**
|
|
24
35
|
* @description 数据集
|
|
25
36
|
* */
|
|
26
37
|
list: GridItemVo[];
|
|
38
|
+
/**
|
|
39
|
+
* @description 自定义键值
|
|
40
|
+
* */
|
|
41
|
+
customKeys?: CustomKeysVo;
|
|
27
42
|
/**
|
|
28
43
|
* @description 宫格的列数(默认 3 )
|
|
29
44
|
* */
|
|
@@ -66,12 +66,12 @@
|
|
|
66
66
|
|
|
67
67
|
&__label {
|
|
68
68
|
@include lineEllipsis;
|
|
69
|
-
overflow: hidden;
|
|
70
69
|
/* #ifndef APP-NVUE */
|
|
71
70
|
line-height: 1;
|
|
72
71
|
/* #endif */
|
|
73
72
|
color: $hy-text-color--grey;
|
|
74
|
-
font-size:
|
|
73
|
+
font-size: $hy-font-size-sm;
|
|
74
|
+
max-width: 150rpx;
|
|
75
75
|
}
|
|
76
76
|
}
|
|
77
77
|
@include b(rotate) {
|