hy-app 0.5.5 → 0.5.7

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.
Files changed (46) hide show
  1. package/components/hy-back-top/props.ts +2 -3
  2. package/components/hy-badge/props.ts +1 -1
  3. package/components/hy-badge/typing.d.ts +5 -0
  4. package/components/hy-button/props.ts +1 -1
  5. package/components/hy-card/hy-card.vue +2 -1
  6. package/components/hy-card/index.scss +5 -1
  7. package/components/hy-card/props.ts +3 -4
  8. package/components/hy-cell/hy-cell.vue +9 -190
  9. package/components/hy-cell/props.ts +7 -26
  10. package/components/hy-cell/typing.d.ts +2 -41
  11. package/components/hy-cell-item/hy-cell-item.vue +160 -0
  12. package/components/hy-cell-item/index.scss +100 -0
  13. package/components/hy-cell-item/props.ts +66 -0
  14. package/components/hy-cell-item/typing.d.ts +7 -0
  15. package/components/hy-checkbox-group/props.ts +1 -1
  16. package/components/hy-checkbox-item/typing.d.ts +3 -3
  17. package/components/hy-grid/props.ts +1 -1
  18. package/components/hy-grid/typing.d.ts +1 -2
  19. package/components/hy-icon/props.ts +1 -1
  20. package/components/hy-icon/typing.d.ts +5 -0
  21. package/components/hy-input/hy-input.vue +19 -22
  22. package/components/hy-input/props.ts +1 -1
  23. package/components/hy-menu/props.ts +2 -2
  24. package/components/hy-number-step/props.ts +1 -1
  25. package/components/hy-price/hy-price.vue +9 -2
  26. package/components/hy-search/props.ts +1 -2
  27. package/components/hy-status-bar/typing.d.ts +12 -0
  28. package/components/hy-sticky/hy-sticky.vue +226 -0
  29. package/components/hy-sticky/index.scss +29 -0
  30. package/components/hy-sticky/props.ts +24 -0
  31. package/components/hy-sticky/typing.d.ts +4 -0
  32. package/components/hy-switch/props.ts +1 -1
  33. package/components/hy-tabbar/props.ts +1 -1
  34. package/components/hy-tabbar-group/index.scss +56 -56
  35. package/components/hy-tabbar-group/props.ts +1 -1
  36. package/components/hy-tabbar-item/index.scss +42 -42
  37. package/components/hy-tabbar-item/props.ts +24 -24
  38. package/components/hy-tabs/props.ts +1 -1
  39. package/components/hy-tag/props.ts +1 -1
  40. package/global.d.ts +1 -0
  41. package/libs/css/theme.scss +1 -1
  42. package/package.json +2 -2
  43. package/web-types.json +1 -1
  44. package/components/hy-cell/index.scss +0 -136
  45. /package/components/hy-tabbar-group/{typing.ts → typing.d.ts} +0 -0
  46. /package/components/hy-tabbar-item/{typing.ts → typing.d.ts} +0 -0
@@ -0,0 +1,66 @@
1
+ import type { CSSProperties, PropType } from 'vue'
2
+ import type { HyIconProps } from '../hy-icon/typing'
3
+
4
+ const cellItemProps = {
5
+ /** 头部标题 */
6
+ title: String,
7
+ /** 标题下面小提示 */
8
+ sub: String,
9
+ /** 是否禁用cell */
10
+ disabled: {
11
+ type: Boolean,
12
+ default: false
13
+ },
14
+ /** 右侧的内容 */
15
+ value: String,
16
+ /** 图标,接收icon对象 */
17
+ icon: {
18
+ type: Object as PropType<HyIconProps>
19
+ },
20
+ /** 右边图标,默认是向左图标 */
21
+ rightIcon: {
22
+ type: Object as PropType<HyIconProps>
23
+ },
24
+ /**
25
+ * 右侧箭头的方向
26
+ * @values left,up,down
27
+ * */
28
+ arrowDirection: {
29
+ type: String,
30
+ default: 'right'
31
+ },
32
+ /**
33
+ * 点击后跳转的URL地址
34
+ * */
35
+ url: {
36
+ type: String,
37
+ default: ''
38
+ },
39
+ /**
40
+ * 链接跳转的方式,内部使用的是uview-plus封装的route方法,可能会进行拦截操作
41
+ * */
42
+ linkType: {
43
+ type: String,
44
+ default: 'navigateTo'
45
+ },
46
+ /**
47
+ * 点击cell是否阻止事件传播
48
+ * */
49
+ stop: {
50
+ type: Boolean,
51
+ default: true
52
+ },
53
+ /**
54
+ * 标识符,用于在click事件中进行返回
55
+ * */
56
+ name: {
57
+ type: [String, Number],
58
+ default: ''
59
+ },
60
+ /** 定义需要用到的外部样式 */
61
+ customStyle: Object as PropType<CSSProperties>,
62
+ /** 自定义外部类名 */
63
+ customClass: String
64
+ }
65
+
66
+ export default cellItemProps
@@ -0,0 +1,7 @@
1
+ import type { ExtractPropTypes, ToRefs } from 'vue'
2
+ import type cellProps from '../hy-cell/props'
3
+
4
+ export interface ICellContext extends ToRefs<ExtractPropTypes<typeof cellProps>> {
5
+ /** 点击事件 */
6
+ onClick: (name: string | number) => void
7
+ }
@@ -75,6 +75,6 @@ const checkboxGroupProps = {
75
75
  customStyle: {
76
76
  type: Object as PropType<CSSProperties>
77
77
  }
78
- }
78
+ } as const
79
79
 
80
80
  export default checkboxGroupProps
@@ -1,7 +1,7 @@
1
- import type HyCheckboxGroupProps from '../hy-checkbox-group/typing'
2
- import type { ToRefs } from 'vue'
1
+ import type checkboxGroupProps from '../hy-checkbox-group/props'
2
+ import type { ExtractPropTypes, ToRefs } from 'vue'
3
3
 
4
- export interface ICheckboxGroupContext extends ToRefs<HyCheckboxGroupProps> {
4
+ export interface ICheckboxGroupContext extends ToRefs<ExtractPropTypes<typeof checkboxGroupProps>> {
5
5
  /** 设置check的状态 */
6
6
  setCheckedStatus: (name: string | number) => void
7
7
  }
@@ -1,5 +1,5 @@
1
1
  import type { CSSProperties, PropType } from 'vue'
2
- import type HyIconProps from '../hy-icon/typing'
2
+ import type { HyIconProps } from '../hy-icon/typing'
3
3
  import type { CustomKeysVo, GridItemVo } from './typing'
4
4
 
5
5
  const gridProps = {
@@ -1,5 +1,4 @@
1
- import { CSSProperties } from 'vue'
2
- import type HyIconProps from '../hy-icon/typing'
1
+ import type { HyIconProps } from '../hy-icon/typing'
3
2
 
4
3
  export interface GridItemVo {
5
4
  /**
@@ -74,6 +74,6 @@ const iconProps = {
74
74
  customStyle: Object as PropType<CSSProperties>,
75
75
  /** 自定义外部类名 */
76
76
  customClass: String
77
- }
77
+ } as const
78
78
 
79
79
  export default iconProps
@@ -1,3 +1,8 @@
1
+ import type { ExtractPropTypes } from 'vue'
2
+ import iconProps from './props'
3
+
4
+ export interface HyIconProps extends ExtractPropTypes<typeof iconProps> {}
5
+
1
6
  export interface IIconEmits {
2
7
  /** 点击图标触发 */
3
8
  (e: 'click', index: string, e: Event): void
@@ -40,7 +40,7 @@
40
40
  :type="type"
41
41
  :focus="focus"
42
42
  :cursor="cursor"
43
- :value="String(innerValue)"
43
+ :value="innerValue"
44
44
  :auto-blur="autoBlur"
45
45
  :disabled="disabled || readonly"
46
46
  :maxlength="maxlength"
@@ -148,13 +148,14 @@ const innerFormatter = (value: string) => value
148
148
  watch(
149
149
  () => props.modelValue,
150
150
  (newVal) => {
151
- if (changeFromInner.value || innerValue.value === newVal) {
152
- changeFromInner.value = false // 重要否则会出现双向绑定失效问题https://github.com/ijry/uview-plus/issues/419
151
+ if (changeFromInner.value || innerValue.value === newVal || newVal === undefined) {
152
+ changeFromInner.value = false
153
153
  return
154
154
  }
155
+ console.log(newVal, 'newVal')
155
156
  innerValue.value = newVal
156
157
  // 在H5中,外部value变化后,修改input中的值,不会触发@input事件,此时手动调用值变化方法
157
- if (firstChange.value === false && changeFromInner.value === false) {
158
+ if (!firstChange.value && !changeFromInner.value) {
158
159
  valueChange(innerValue.value, true)
159
160
  }
160
161
  firstChange.value = false
@@ -165,14 +166,14 @@ watch(
165
166
  )
166
167
 
167
168
  /**
168
- * @description 是否显示清除控件
169
+ * 是否显示清除控件
169
170
  * */
170
171
  const isShowClear = computed(() => {
171
172
  const { clearable, readonly, disabled } = props
172
173
  return clearable && !readonly && !disabled && innerValue.value !== ''
173
174
  })
174
175
  /**
175
- * @description 组件的类名
176
+ * 组件的类名
176
177
  * */
177
178
  const inputClass = computed((): string => {
178
179
  let classes: string[] = [],
@@ -185,7 +186,7 @@ const inputClass = computed((): string => {
185
186
  })
186
187
 
187
188
  /**
188
- * @description 组件的样式
189
+ * 组件的样式
189
190
  * */
190
191
  const wrapperStyle = computed((): CSSProperties => {
191
192
  const style: CSSProperties = {}
@@ -200,9 +201,9 @@ const wrapperStyle = computed((): CSSProperties => {
200
201
  return Object.assign(style, props.customStyle)
201
202
  })
202
203
  /**
203
- * @description 输入框的样式
204
+ * 输入框的样式
204
205
  * */
205
- const inputStyle = computed((): CSSProperties => {
206
+ const inputStyle = computed(() => {
206
207
  return {
207
208
  color: props.color,
208
209
  fontSize: addUnit(props.fontSize),
@@ -211,7 +212,7 @@ const inputStyle = computed((): CSSProperties => {
211
212
  })
212
213
 
213
214
  /**
214
- * @description 边框颜色
215
+ * 边框颜色
215
216
  * */
216
217
  const borderStyle = computed(() => {
217
218
  return (isFocus: boolean) => {
@@ -233,13 +234,10 @@ const borderStyle = computed(() => {
233
234
  })
234
235
 
235
236
  /**
236
- * @description 当键盘输入时,触发input事件
237
+ * 当键盘输入时,触发input事件
237
238
  */
238
239
  const onInput = (e: any) => {
239
240
  let { value = '' } = e.detail || {}
240
- // 为了避免props的单向数据流特性,需要先将innerValue值设置为当前值,再在$nextTick中重新赋予设置后的值才有效
241
- // console.log('onInput', value, this.innerValue)
242
- innerValue.value = value
243
241
  nextTick(() => {
244
242
  let formatValue = innerFormatter(value)
245
243
  innerValue.value = formatValue
@@ -247,7 +245,7 @@ const onInput = (e: any) => {
247
245
  })
248
246
  }
249
247
  /**
250
- * @description 输入框失去焦点时触发
248
+ * 输入框失去焦点时触发
251
249
  * */
252
250
  const onBlur = async (event: InputOnBlurEvent) => {
253
251
  emit('blur', event, event.detail.value)
@@ -256,7 +254,7 @@ const onBlur = async (event: InputOnBlurEvent) => {
256
254
  focused.value = false
257
255
  }
258
256
  /**
259
- * @description 输入框聚焦时触发
257
+ * 输入框聚焦时触发
260
258
  * */
261
259
  const onFocus = (e: InputOnFocusEvent) => {
262
260
  focused.value = true
@@ -264,7 +262,7 @@ const onFocus = (e: InputOnFocusEvent) => {
264
262
  }
265
263
 
266
264
  /**
267
- * @description 点击完成按钮时触发
265
+ * 点击完成按钮时触发
268
266
  * */
269
267
  const onConfirm = (e: InputOnConfirmEvent) => {
270
268
  emit('confirm', e, innerValue.value)
@@ -288,15 +286,14 @@ const valueChange = (value: string | number, isOut = false) => {
288
286
  if (!isOut || clearInput.value) {
289
287
  // 标识value值的变化是由内部引起的
290
288
  changeFromInner.value = true
289
+ emit('update:modelValue', value)
291
290
  emit('change', value)
292
291
  if (formItem) formItem.handleChange(value)
293
-
294
- emit('update:modelValue', value)
295
292
  }
296
293
  })
297
294
  }
298
295
  /**
299
- * @description 点击清除控件
296
+ * 点击清除控件
300
297
  */
301
298
  const onClear = () => {
302
299
  clearInput.value = true
@@ -319,13 +316,13 @@ const clickHandler = () => {
319
316
  }
320
317
 
321
318
  /**
322
- * @description 点击前缀
319
+ * 点击前缀
323
320
  * */
324
321
  const onPrefix = () => {
325
322
  emit('onPrefix')
326
323
  }
327
324
  /**
328
- * @description 点击后缀
325
+ * 点击后缀
329
326
  * */
330
327
  const onSuffix = () => {
331
328
  emit('onSuffix')
@@ -1,6 +1,6 @@
1
1
  import type { CSSProperties, PropType } from 'vue'
2
2
  import type { InputConfirmType } from '@uni-helper/uni-types'
3
- import type HyIconProps from '../hy-icon/typing'
3
+ import type { HyIconProps } from '../hy-icon/typing'
4
4
 
5
5
  const inputProps = {
6
6
  /** 输入的值 */
@@ -1,7 +1,7 @@
1
1
  import type { MenusType, ModelValueVo } from './typing'
2
2
  import type { CSSProperties, PropType } from 'vue'
3
- import type HyIconProps from '../hy-icon/typing'
4
- import type HyBadgeProps from '../hy-badge/typing'
3
+ import type { HyIconProps } from '../hy-icon/typing'
4
+ import type { HyBadgeProps } from '../hy-badge/typing'
5
5
 
6
6
  const menuProps = {
7
7
  /** 当前值 */
@@ -1,4 +1,4 @@
1
- import type HyIconProps from './typing'
1
+ import type { HyIconProps } from '../hy-icon/typing'
2
2
  import type { PropType } from 'vue'
3
3
 
4
4
  const numberStepProps = {
@@ -54,10 +54,17 @@ const priceOne = computed(() => {
54
54
  if (props.text === undefined || props.text === null) return error('text值不能为空')
55
55
 
56
56
  let value = typeof props.text === 'string' ? props.text : props.text.toString()
57
+
58
+ // 格式化整数部分为千分位
59
+ const formatValue = (val: string) => {
60
+ return val.replace(/\B(?=(\d{3})+(?!\d))/g, ',')
61
+ }
62
+
57
63
  if (/\./g.test(value)) {
58
- return Number(value) ? value.split('.') : ['0', '000000']
64
+ const [integer, decimal] = value.split('.')
65
+ return [formatValue(integer), decimal]
59
66
  } else {
60
- return [value, '000000']
67
+ return [formatValue(value), '000000']
61
68
  }
62
69
  })
63
70
 
@@ -1,7 +1,6 @@
1
1
  import type { CSSProperties, PropType } from 'vue'
2
- import type { InputConfirmType } from '@uni-helper/uni-types'
3
2
  import { IconConfig } from '../../libs'
4
- import type HyIconProps from '../hy-icon/typing'
3
+ import type { HyIconProps } from '../hy-icon/typing'
5
4
 
6
5
  const searchProps = {
7
6
  /** 输入框初始值 */
@@ -0,0 +1,12 @@
1
+ import type { CSSProperties } from 'vue'
2
+
3
+ export default interface HyStatusBarProps {
4
+ /**
5
+ * @description 背景色 (默认 'transparent' )
6
+ * */
7
+ bgColor?: string
8
+ /**
9
+ * @description 自定义样式
10
+ * */
11
+ customStyle?: CSSProperties
12
+ }
@@ -0,0 +1,226 @@
1
+ <template>
2
+ <view>
3
+ <!-- 哨兵必须在 sticky 前面 -->
4
+ <view :id="sentinelId" class="hy-sticky__sentinel"></view>
5
+
6
+ <!-- 占位元素:当吸顶后占据原高度,避免页面抖动 -->
7
+ <view v-if="isFixed" :style="{ height: placeholderHeight + 'px' }" />
8
+
9
+ <view
10
+ ref="stickyRef"
11
+ :class="['hy-sticky', isFixed ? 'hy-sticky__fixed' : '']"
12
+ :style="mergedStyle"
13
+ >
14
+ <slot />
15
+ </view>
16
+ </view>
17
+ </template>
18
+
19
+ <script setup lang="ts">
20
+ import { ref, computed, onMounted, onUnmounted, nextTick, getCurrentInstance, watch } from 'vue'
21
+ import type { CSSProperties } from 'vue'
22
+ import { onPageScroll } from '@dcloudio/uni-app'
23
+ import { addUnit, getRect } from '../../libs'
24
+ import type { IStickyEmits } from './typing'
25
+ import stickyProps from './props'
26
+
27
+ const props = defineProps(stickyProps)
28
+ const emit = defineEmits<IStickyEmits>()
29
+
30
+ const instance = getCurrentInstance()
31
+ const sentinelId = `hy-sticky-sentinel-${Math.random().toString(36).slice(2, 9)}`
32
+ const stickyRef = ref<HTMLElement | null>(null)
33
+ const isFixed = ref(false)
34
+ const placeholderHeight = ref(0)
35
+ let observer: UniApp.IntersectionObserver | null = null
36
+ let rafTimer = 0
37
+
38
+ // 组件样式(吸顶时使用 fixed/fallback)
39
+ // 注意:position: sticky 在部分平台失效时,我们使用绝对 fixed 样式做回退
40
+ const mergedStyle = computed<CSSProperties>(() => {
41
+ if (!props.enable) return {}
42
+ if (isFixed.value) {
43
+ // fixed 样式回退,尽量跟 sticky 表现一致
44
+ return {
45
+ position: 'fixed',
46
+ top: addUnit(props.offsetTop),
47
+ left: '0px',
48
+ right: '0px',
49
+ zIndex: props.zIndex
50
+ // 保持宽度,如果需要你可以传入宽度样式到 custom style slot
51
+ }
52
+ } else {
53
+ return {
54
+ position: 'sticky',
55
+ top: addUnit(props.offsetTop),
56
+ zIndex: props.zIndex
57
+ }
58
+ }
59
+ })
60
+
61
+ // Helper: 查询哨兵和 sticky 高度/位置
62
+ const querySentinel = (): Promise<{
63
+ sentinelTop: number
64
+ sentinelBottom: number
65
+ stickyHeight: number
66
+ }> => {
67
+ return new Promise((resolve) => {
68
+ const query = uni.createSelectorQuery().in(instance!)
69
+ query
70
+ .select(`#${sentinelId}`)
71
+ .boundingClientRect()
72
+ .selectViewport()
73
+ .exec((res: any[]) => {
74
+ // res 结构:[ sentinelRect, viewportRect ]
75
+ const sentinelRect = res[0] || {}
76
+ const viewportRect = res[1] || {}
77
+ const stickyRectQuery = uni.createSelectorQuery().in(instance!)
78
+ stickyRectQuery
79
+ .select('.hy-sticky')
80
+ .boundingClientRect()
81
+ .exec((r2: any[]) => {
82
+ const stickyRect = (r2 && r2[0]) || {}
83
+ resolve({
84
+ sentinelTop: sentinelRect.top ?? 0,
85
+ sentinelBottom: sentinelRect.bottom ?? 0,
86
+ stickyHeight: stickyRect.height ?? 0
87
+ })
88
+ })
89
+ })
90
+ })
91
+ }
92
+
93
+ // IntersectionObserver 初始化(优先)
94
+ const initObserver = async () => {
95
+ if (!props.enable) return
96
+ // 先断开之前的
97
+ observer?.disconnect()
98
+ observer = null
99
+
100
+ try {
101
+ // 若用户传入 scrollSelector,则使用 relativeTo(container)
102
+ const ins = instance!
103
+ const io = uni.createIntersectionObserver(ins, {
104
+ thresholds: [0, 1]
105
+ })
106
+
107
+ if (props.scrollSelector) {
108
+ // 使用相对容器(scroll-view)
109
+ io.relativeTo(`.${props.scrollSelector}`, { top: props.offsetTop })
110
+ } else {
111
+ // 使用视口
112
+ io.relativeToViewport({ top: -props.offsetTop })
113
+ }
114
+
115
+ io.observe(`#${sentinelId}`, (res) => {
116
+ const fixed = res.boundingClientRect.top <= props.offsetTop
117
+ if (fixed !== isFixed.value) {
118
+ // 当切换为 fixed,记录占位高度
119
+ if (fixed) {
120
+ // 获取 sticky 高度作为占位
121
+ getRect('.hy-sticky', false, instance).then((rect) => {
122
+ placeholderHeight.value = rect?.height ? rect.height : 0
123
+ })
124
+ } else {
125
+ placeholderHeight.value = 0
126
+ }
127
+ isFixed.value = fixed
128
+ emit('change', fixed)
129
+ }
130
+ })
131
+
132
+ observer = io
133
+ } catch (e) {
134
+ // createIntersectionObserver 在极少数平台可能抛错,交给回退逻辑
135
+ observer = null
136
+ }
137
+ }
138
+
139
+ const pageScrollHandler = () => {
140
+ if (rafTimer) return
141
+ rafTimer = requestAnimationFrame(async () => {
142
+ rafTimer = 0
143
+
144
+ const { sentinelBottom, stickyHeight } = await querySentinel()
145
+ const offset = props.offsetTop
146
+
147
+ // 用 bottom 判断,保证吸顶时位置保持 offset
148
+ const fixed = sentinelBottom <= offset
149
+
150
+ if (fixed !== isFixed.value) {
151
+ isFixed.value = fixed
152
+
153
+ if (fixed) {
154
+ placeholderHeight.value = stickyHeight
155
+ } else {
156
+ placeholderHeight.value = 0
157
+ }
158
+
159
+ emit('change', fixed)
160
+ }
161
+ })
162
+ }
163
+
164
+ const onPageScrollListener = (e: any) => {
165
+ // 仅当 enable 时才处理
166
+ if (!props.enable) return
167
+ // 如果我们已经有 observer 且工作正常,则可以不必依赖回退(但保留检查以防万一)
168
+ // 这里仍然执行 pageScrollHandler 以防 observer 未触发
169
+ pageScrollHandler()
170
+ }
171
+
172
+ // 供外部触发重置(比如内容加载高度变化)
173
+ const refresh = async () => {
174
+ await nextTick()
175
+ // 重新测高度
176
+ getRect('.hy-sticky', false, instance).then((rect) => {
177
+ placeholderHeight.value = rect?.height ? rect.height : 0
178
+ })
179
+ // 重新 init observer
180
+ await initObserver()
181
+ // 手动触发一次检测
182
+ pageScrollHandler()
183
+ }
184
+
185
+ onMounted(() => {
186
+ nextTick(async () => {
187
+ await initObserver()
188
+
189
+ // 始终绑定 page scroll 回退(能兼容大多数场景)
190
+ // 注意:如果页面使用 scroll-view(而非页面滚动),你应传入 scrollSelector 以使用 relativeTo(container)
191
+ onPageScroll && onPageScroll(onPageScrollListener)
192
+ })
193
+ })
194
+
195
+ onUnmounted(() => {
196
+ observer?.disconnect()
197
+ observer = null
198
+ // 解除 pageScroll 监听:uni-app 没有 onPageScroll.off,onPageScroll 是全局注册的,通常不需要解绑
199
+ // 但是我们清理 raf
200
+ if (rafTimer) cancelAnimationFrame(rafTimer)
201
+ })
202
+
203
+ // 如果 enable 改变,重置
204
+ watch(
205
+ () => props.enable,
206
+ (v) => {
207
+ if (v) {
208
+ refresh()
209
+ } else {
210
+ observer?.disconnect()
211
+ observer = null
212
+ isFixed.value = false
213
+ placeholderHeight.value = 0
214
+ }
215
+ }
216
+ )
217
+
218
+ defineExpose({
219
+ refresh
220
+ })
221
+ </script>
222
+
223
+ <style lang="scss" scoped>
224
+ @import './index.scss';
225
+ @import './index.scss';
226
+ </style>
@@ -0,0 +1,29 @@
1
+ @use "../../libs/css/theme" as *;
2
+ @use "../../libs/css/mixin.scss" as *;
3
+
4
+ @include b(sticky) {
5
+ width: 100%;
6
+ /* 默认 sticky(非 fixed)样式 */
7
+ position: -webkit-sticky;
8
+ position: sticky;
9
+ top: 0;
10
+ left: 0;
11
+ right: 0;
12
+ background: #fff;
13
+ box-sizing: border-box;
14
+
15
+ @include e(fixed) {
16
+ /* 在这里加过渡 */
17
+ transition:
18
+ box-shadow 0.18s ease,
19
+ transform 0.18s ease;
20
+ }
21
+
22
+ /* 哨兵样式:不可见但参与布局 */
23
+ @include e(sentinel) {
24
+ height: 1px;
25
+ opacity: 0;
26
+ pointer-events: none;
27
+ }
28
+
29
+ }
@@ -0,0 +1,24 @@
1
+ const stickyProps = {
2
+ /** 吸顶时距离顶部的偏移量(单位:px) */
3
+ zIndex: {
4
+ type: [String, Number],
5
+ default: 99
6
+ },
7
+ /** 吸顶时的层级 */
8
+ offsetTop: {
9
+ type: [String, Number],
10
+ default: 0
11
+ },
12
+ /** 是否启用吸顶功能 */
13
+ enable: {
14
+ type: Boolean,
15
+ default: true
16
+ },
17
+ /** 在scroll-view内使用时,指定scroll-view的类名(不含点) */
18
+ scrollSelector: {
19
+ type: String,
20
+ default: ''
21
+ }
22
+ }
23
+
24
+ export default stickyProps
@@ -0,0 +1,4 @@
1
+ export interface IStickyEmits {
2
+ /** 固定时候执行 */
3
+ (e: 'change', isFixed: boolean): void
4
+ }
@@ -1,6 +1,6 @@
1
1
  import type { CSSProperties, PropType } from 'vue'
2
2
  import type { SwitchValue } from './typing'
3
- import type HyIconProps from '../hy-icon/typing'
3
+ import type { HyIconProps } from '../hy-icon/typing'
4
4
 
5
5
  const switchProps = {
6
6
  /** 通过v-model双向绑定的值 */
@@ -1,5 +1,5 @@
1
1
  import type { CSSProperties, PropType } from 'vue'
2
- import type HyBadgeProps from '../hy-badge/typing'
2
+ import type { HyBadgeProps } from '../hy-badge/typing'
3
3
 
4
4
  const tabBarProps = {
5
5
  /** 选中项的索引值 */