hy-app 0.5.12 → 0.5.14

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.
@@ -14,6 +14,9 @@
14
14
  box-sizing: border-box;
15
15
  /* #endif */
16
16
  flex-direction: row;
17
+ /* 防止文字内容被压缩换行 */
18
+ flex-shrink: 0;
19
+
17
20
 
18
21
  /* 亮光效果 */
19
22
  &::before {
@@ -1,161 +1,161 @@
1
- <template>
2
- <view
3
- :class="cellClass"
4
- :hover-class="hoverClass"
5
- :style="customStyle"
6
- :hover-stay-time="250"
7
- @tap="clickHandler"
8
- >
9
- <view class="hy-cell-item__left">
10
- <view v-if="icon || $slots.icon" class="hy-cell-item__left--icon">
11
- <!-- @slot 图标插槽 -->
12
- <slot v-if="$slots.icon" name="icon" :icon="item?.icon"></slot>
13
- <hy-icon
14
- v-else
15
- :size="iconSize"
16
- :name="icon?.name"
17
- :color="!!(disabled || cellConfig?.disabled.value) ? '#FFFFFF3F' : icon?.color"
18
- :bold="icon?.bold"
19
- :customPrefix="icon?.customPrefix"
20
- :imgMode="icon?.imgMode"
21
- :width="icon?.width"
22
- :height="icon?.height"
23
- :top="icon?.top"
24
- :stop="icon?.stop"
25
- :round="icon?.round"
26
- :customStyle="icon?.customStyle"
27
- :customClass="icon?.customClass"
28
- ></hy-icon>
29
- </view>
30
- <view class="hy-cell-item__left--title">
31
- <!-- @slot 列表标题插槽 -->
32
- <slot v-if="$slots.title" name="title" :title="title"></slot>
33
- <text v-else class="hy-cell-item__left--title__text">
34
- {{ title }}
35
- </text>
36
- <!-- @slot 列表小标题插槽 -->
37
- <slot v-if="$slots.sub" name="sub" :sub="sub"></slot>
38
- <text v-else-if="sub" class="hy-cell-item__left--title__sub">
39
- {{ sub }}
40
- </text>
41
- </view>
42
- </view>
43
- <view
44
- class="hy-cell-item__center"
45
- :style="{
46
- justifyContent:
47
- cellConfig?.arrange.value === 'left'
48
- ? 'flex-start'
49
- : cellConfig?.arrange.value === 'right'
50
- ? 'flex-end'
51
- : 'center'
52
- }"
53
- >
54
- <!-- @slot 值内容插槽 -->
55
- <slot v-if="$slots.value" name="value" :record="item"></slot>
56
- <text v-else-if="value" class="hy-cell-item__center--value">
57
- {{ value }}
58
- </text>
59
- </view>
60
- <view
61
- :class="[
62
- 'hy-cell-item__right',
63
- `hy-cell-item__right--${cellConfig?.arrowDirection.value}`
64
- ]"
65
- v-if="cellConfig?.isRightIcon.value"
66
- >
67
- <!-- @slot 右边按钮插槽 -->
68
- <slot v-if="$slots['right-icon']" name="right-icon" :icon="rightIcon"></slot>
69
- <hy-icon
70
- v-else
71
- :name="rightIcon?.name || IconConfig.RIGHT"
72
- :color="!!(disabled || cellConfig?.disabled.value) ? '#FFFFFF3F' : rightIcon?.color"
73
- :bold="rightIcon?.bold"
74
- :customPrefix="rightIcon?.customPrefix"
75
- :imgMode="rightIcon?.imgMode"
76
- :width="rightIcon?.width"
77
- :height="rightIcon?.height"
78
- :stop="rightIcon?.stop"
79
- :round="rightIcon?.round"
80
- :customStyle="rightIcon?.customStyle"
81
- :customClass="rightIcon?.customClass"
82
- ></hy-icon>
83
- </view>
84
- </view>
85
- </template>
86
-
87
- <script lang="ts">
88
- export default {
89
- name: 'hy-cell-item',
90
- options: {
91
- virtualHost: true,
92
- styleIsolation: 'shared'
93
- }
94
- }
95
- </script>
96
-
97
- <script setup lang="ts">
98
- import { computed, inject } from 'vue'
99
- import cellItemProps from './props'
100
- import type { ICellContext } from './typing'
101
- import { IconConfig } from '../../libs'
102
- import type { ICellEmits } from '../hy-cell/typing'
103
- // 组件
104
- import HyIcon from '../hy-icon/hy-icon.vue'
105
-
106
- const props = defineProps(cellItemProps)
107
- const emit = defineEmits<ICellEmits>()
108
- const cellConfig = inject<ICellContext>('hy-cell')
109
-
110
- // 单元格类名
111
- const cellClass = computed(() => {
112
- return [
113
- 'hy-cell-item',
114
- `hy-cell-item--${cellConfig?.size.value}`,
115
- cellConfig?.border.value && 'hy-border__bottom',
116
- (props.disabled || cellConfig?.disabled.value) && 'hy-cell-item__disabled',
117
- props.customClass
118
- ]
119
- })
120
-
121
- // 计算什么时候出现点击状态
122
- const hoverClass = computed(() => {
123
- if (!(props.disabled || cellConfig?.disabled.value) && cellConfig?.clickable.value) {
124
- return 'hy-cell-item__clickable'
125
- } else {
126
- return ''
127
- }
128
- })
129
-
130
- // 图标大小
131
- const iconSize = computed(() => {
132
- switch (cellConfig?.size.value) {
133
- case 'large':
134
- return 25
135
- case 'medium':
136
- return 20
137
- case 'small':
138
- return 15
139
- }
140
- })
141
-
142
- /**
143
- * 点击cell
144
- * */
145
- const clickHandler = (e: Event) => {
146
- if (cellConfig?.disabled.value || props.disabled) return
147
- if (props.stop) e.stopPropagation()
148
-
149
- emit('click', props.name)
150
- cellConfig?.onClick(props.name)
151
- if (props.url) {
152
- ;(uni as any)[props.linkType]({
153
- url: props.url
154
- })
155
- }
156
- }
157
- </script>
158
-
159
- <style lang="scss" scoped>
160
- @import './index.scss';
161
- </style>
1
+ <template>
2
+ <view
3
+ :class="cellClass"
4
+ :hover-class="hoverClass"
5
+ :style="customStyle"
6
+ :hover-stay-time="250"
7
+ @tap="clickHandler"
8
+ >
9
+ <view class="hy-cell-item__left">
10
+ <view v-if="icon || $slots.icon" class="hy-cell-item__left--icon">
11
+ <!-- @slot 图标插槽 -->
12
+ <slot v-if="$slots.icon" name="icon" :icon="item?.icon"></slot>
13
+ <hy-icon
14
+ v-else
15
+ :size="iconSize"
16
+ :name="icon?.name"
17
+ :color="!!(disabled || cellConfig?.disabled.value) ? '#FFFFFF3F' : icon?.color"
18
+ :bold="icon?.bold"
19
+ :customPrefix="icon?.customPrefix"
20
+ :imgMode="icon?.imgMode"
21
+ :width="icon?.width"
22
+ :height="icon?.height"
23
+ :top="icon?.top"
24
+ :stop="icon?.stop"
25
+ :round="icon?.round"
26
+ :customStyle="icon?.customStyle"
27
+ :customClass="icon?.customClass"
28
+ ></hy-icon>
29
+ </view>
30
+ <view class="hy-cell-item__left--title">
31
+ <!-- @slot 列表标题插槽 -->
32
+ <slot v-if="$slots.title" name="title" :title="title"></slot>
33
+ <text v-else class="hy-cell-item__left--title__text">
34
+ {{ title }}
35
+ </text>
36
+ <!-- @slot 列表小标题插槽 -->
37
+ <slot v-if="$slots.sub" name="sub" :sub="sub"></slot>
38
+ <text v-else-if="sub" class="hy-cell-item__left--title__sub">
39
+ {{ sub }}
40
+ </text>
41
+ </view>
42
+ </view>
43
+ <view
44
+ class="hy-cell-item__center"
45
+ :style="{
46
+ justifyContent:
47
+ cellConfig?.arrange.value === 'left'
48
+ ? 'flex-start'
49
+ : cellConfig?.arrange.value === 'right'
50
+ ? 'flex-end'
51
+ : 'center'
52
+ }"
53
+ >
54
+ <!-- @slot 值内容插槽 -->
55
+ <slot v-if="$slots.value" name="value" :record="item"></slot>
56
+ <text v-else-if="value" class="hy-cell-item__center--value">
57
+ {{ value }}
58
+ </text>
59
+ </view>
60
+ <view
61
+ :class="[
62
+ 'hy-cell-item__right',
63
+ `hy-cell-item__right--${cellConfig?.arrowDirection.value}`
64
+ ]"
65
+ v-if="cellConfig?.isRightIcon.value"
66
+ >
67
+ <!-- @slot 右边按钮插槽 -->
68
+ <slot v-if="$slots['right-icon']" name="right-icon" :icon="rightIcon"></slot>
69
+ <hy-icon
70
+ v-else
71
+ :name="rightIcon?.name || IconConfig.RIGHT"
72
+ :color="!!(disabled || cellConfig?.disabled.value) ? '#FFFFFF3F' : rightIcon?.color"
73
+ :bold="rightIcon?.bold"
74
+ :customPrefix="rightIcon?.customPrefix"
75
+ :imgMode="rightIcon?.imgMode"
76
+ :width="rightIcon?.width"
77
+ :height="rightIcon?.height"
78
+ :stop="rightIcon?.stop"
79
+ :round="rightIcon?.round"
80
+ :customStyle="rightIcon?.customStyle"
81
+ :customClass="rightIcon?.customClass"
82
+ ></hy-icon>
83
+ </view>
84
+ </view>
85
+ </template>
86
+
87
+ <script lang="ts">
88
+ export default {
89
+ name: 'hy-cell-item',
90
+ options: {
91
+ virtualHost: true,
92
+ styleIsolation: 'shared'
93
+ }
94
+ }
95
+ </script>
96
+
97
+ <script setup lang="ts">
98
+ import { computed, inject } from 'vue'
99
+ import cellItemProps from './props'
100
+ import type { ICellContext } from './typing'
101
+ import { IconConfig } from '../../libs'
102
+ import type { ICellEmits } from '../hy-cell/typing'
103
+ // 组件
104
+ import HyIcon from '../hy-icon/hy-icon.vue'
105
+
106
+ const props = defineProps(cellItemProps)
107
+ const emit = defineEmits<ICellEmits>()
108
+ const cellConfig = inject<ICellContext>('hy-cell')
109
+
110
+ // 单元格类名
111
+ const cellClass = computed(() => {
112
+ return [
113
+ 'hy-cell-item',
114
+ `hy-cell-item--${cellConfig?.size.value}`,
115
+ cellConfig?.border.value && 'hy-border__bottom',
116
+ (props.disabled || cellConfig?.disabled.value) && 'hy-cell-item__disabled',
117
+ props.customClass
118
+ ]
119
+ })
120
+
121
+ // 计算什么时候出现点击状态
122
+ const hoverClass = computed(() => {
123
+ if (!(props.disabled || cellConfig?.disabled.value) && cellConfig?.clickable.value) {
124
+ return 'hy-cell-item__clickable'
125
+ } else {
126
+ return ''
127
+ }
128
+ })
129
+
130
+ // 图标大小
131
+ const iconSize = computed(() => {
132
+ switch (cellConfig?.size.value) {
133
+ case 'large':
134
+ return 25
135
+ case 'medium':
136
+ return 20
137
+ case 'small':
138
+ return 15
139
+ }
140
+ })
141
+
142
+ /**
143
+ * 点击cell
144
+ * */
145
+ const clickHandler = (e: Event) => {
146
+ if (cellConfig?.disabled.value || props.disabled) return
147
+ if (props.stop) e.stopPropagation()
148
+
149
+ emit('click', props.name)
150
+ cellConfig?.onClick(props.name)
151
+ if (props.url) {
152
+ uni.navigateTo({
153
+ url: props.url
154
+ })
155
+ }
156
+ }
157
+ </script>
158
+
159
+ <style lang="scss" scoped>
160
+ @import './index.scss';
161
+ </style>
@@ -1,66 +1,59 @@
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
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
+ * 点击cell是否阻止事件传播
41
+ * */
42
+ stop: {
43
+ type: Boolean,
44
+ default: true
45
+ },
46
+ /**
47
+ * 标识符,用于在click事件中进行返回
48
+ * */
49
+ name: {
50
+ type: [String, Number],
51
+ default: ''
52
+ },
53
+ /** 定义需要用到的外部样式 */
54
+ customStyle: Object as PropType<CSSProperties>,
55
+ /** 自定义外部类名 */
56
+ customClass: String
57
+ }
58
+
59
+ export default cellItemProps
@@ -5,14 +5,11 @@
5
5
  @include b(config-provider) {
6
6
  box-sizing: border-box;
7
7
  width: 100%;
8
- /* #ifdef H5 */
9
- height: calc(100vh - 44px);
10
- /* #endif */
11
- /* #ifndef H5 */
12
- height: 100vh;
13
- /* #endif */
14
- overflow-y: auto;
15
- overflow-x: hidden;
8
+ height: calc(100vh - var(--window-top));
9
+ height: calc(100vh - var(--window-top) - constant(safe-area-inset-bottom));
10
+ height: calc(100vh - var(--window-top) - env(safe-area-inset-bottom));
11
+ //overflow-y: auto;
12
+ //overflow-x: hidden;
16
13
  background-color: $hy-background;
17
14
  color: $hy-text-color;
18
15
  }
@@ -1,7 +1,8 @@
1
1
  @use '../../libs/css/mixin' as *;
2
2
  @use '../../libs/css/theme.scss' as *;
3
3
 
4
- $hy-box-width: 180rpx;
4
+ $hy-coupon--box-width: 180rpx;
5
+ $hy-coupon--bg-height: 166rpx;
5
6
  @include b(coupon) {
6
7
  width: 100%;
7
8
  min-height: 190rpx;
@@ -32,10 +33,10 @@ $hy-box-width: 180rpx;
32
33
  /* 不同类型优惠券的背景色 */
33
34
  @include m(moneyOff) {
34
35
  background:
35
- radial-gradient(circle at $hy-box-width top, transparent 15rpx, #ff7d00 0) top / 100% 85px
36
+ radial-gradient(circle at $hy-coupon--box-width top, transparent 15rpx, #ff7d00 0) top / 100% $hy-coupon--bg-height
36
37
  no-repeat,
37
- radial-gradient(circle at $hy-box-width bottom, transparent 15rpx, #ff7d00 0) bottom / 100%
38
- 85px no-repeat;
38
+ radial-gradient(circle at $hy-coupon--box-width bottom, transparent 15rpx, #ff7d00 0) bottom / 100%
39
+ $hy-coupon--bg-height no-repeat;
39
40
  //background:
40
41
  // radial-gradient(circle at left center, transparent 15rpx, #ff7d00 0) left center / 30rpx 100% no-repeat,
41
42
  // radial-gradient(circle at right center, transparent 15rpx, #ff7d00 0) right center / 30rpx 100% no-repeat;
@@ -44,17 +45,17 @@ $hy-box-width: 180rpx;
44
45
  }
45
46
  @include m(discount) {
46
47
  background:
47
- radial-gradient(circle at $hy-box-width top, transparent 15rpx, #00c6ff 0) top / 100% 70px
48
+ radial-gradient(circle at $hy-coupon--box-width top, transparent 15rpx, #00c6ff 0) top / 100% $hy-coupon--bg-height
48
49
  no-repeat,
49
- radial-gradient(circle at $hy-box-width bottom, transparent 15rpx, #00c6ff 0) bottom / 100%
50
- 51px no-repeat;
50
+ radial-gradient(circle at $hy-coupon--box-width bottom, transparent 15rpx, #00c6ff 0) bottom / 100%
51
+ $hy-coupon--bg-height no-repeat;
51
52
  }
52
53
  @include m(fixedAmount) {
53
54
  background:
54
- radial-gradient(circle at $hy-box-width top, transparent 15rpx, $hy-error 0) top / 100% 70px
55
+ radial-gradient(circle at $hy-coupon--box-width top, transparent 15rpx, $hy-error 0) top / 100% $hy-coupon--bg-height
55
56
  no-repeat,
56
- radial-gradient(circle at $hy-box-width bottom, transparent 15rpx, $hy-error 0) bottom / 100%
57
- 51px no-repeat;
57
+ radial-gradient(circle at $hy-coupon--box-width bottom, transparent 15rpx, $hy-error 0) bottom / 100%
58
+ $hy-coupon--bg-height no-repeat;
58
59
  }
59
60
 
60
61
  /* 优惠券内容区域 */
@@ -72,7 +73,7 @@ $hy-box-width: 180rpx;
72
73
  justify-content: center;
73
74
  align-items: center;
74
75
  height: 100%;
75
- width: $hy-box-width;
76
+ width: $hy-coupon--box-width;
76
77
  padding: $hy-border-margin-padding-base;
77
78
  box-sizing: border-box;
78
79
  flex-shrink: 0;
@@ -35,6 +35,11 @@ const couponProps = {
35
35
  type: String,
36
36
  default: ''
37
37
  },
38
+ /** 描述省略行数,none不省略,1代表一行省略 */
39
+ desEllipsis: {
40
+ type: [String, Number],
41
+ default: 'none'
42
+ },
38
43
  /** 优惠券金额 */
39
44
  amount: {
40
45
  type: [String, Number],
@@ -45,11 +50,6 @@ const couponProps = {
45
50
  type: String,
46
51
  default: ''
47
52
  },
48
- /** 描述省略行数,none不省略,1代表一行省略 */
49
- desEllipsis: {
50
- type: [String, Number],
51
- default: 'none'
52
- },
53
53
  /** 优惠券开始时间 */
54
54
  startDate: {
55
55
  type: String,