uview-plus 3.3.40 → 3.3.42

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/changelog.md CHANGED
@@ -1,3 +1,11 @@
1
+ ## 3.3.42(2024-11-15)
2
+ add: button组件支持stop参数阻止冒泡
3
+
4
+ ## 3.3.41(2024-11-13)
5
+ fix: u-radio-group invalid import
6
+
7
+ improvement: 优化图片组件宽高及修复事件event传递
8
+
1
9
  ## 3.3.40(2024-11-11)
2
10
  add: 组件radioGroup增加gap属性用于设置item间隔
3
11
 
@@ -37,6 +37,7 @@ export default {
37
37
  text: '',
38
38
  icon: '',
39
39
  iconColor: '',
40
- color: ''
40
+ color: '',
41
+ stop: true,
41
42
  }
42
43
  }
@@ -149,6 +149,11 @@ export const props = defineMixin({
149
149
  color: {
150
150
  type: String,
151
151
  default: () => defProps.button.color
152
- }
152
+ },
153
+ // 停止冒泡
154
+ stop: {
155
+ type: Boolean,
156
+ default: () => defProps.button.stop
157
+ },
153
158
  }
154
159
  })
@@ -271,7 +271,7 @@ export default {
271
271
  'error', 'opensetting', 'launchapp', 'agreeprivacyauthorization'],
272
272
  methods: {
273
273
  addStyle,
274
- clickHandler() {
274
+ clickHandler(e: any) {
275
275
  // 非禁止并且非加载中,才能点击
276
276
  if (!this.disabled && !this.loading) {
277
277
  // 进行节流控制,每this.throttle毫秒内,只在开始处执行
@@ -279,6 +279,8 @@ export default {
279
279
  this.$emit("click");
280
280
  }, this.throttleTime);
281
281
  }
282
+ // 是否阻止事件传播
283
+ this.stop && this.preventEvent(e)
282
284
  },
283
285
  // 下面为对接uniapp官方按钮开放能力事件回调的对接
284
286
  getphonenumber(res: any) {
@@ -0,0 +1,122 @@
1
+ <template>
2
+ <view
3
+ class="u-float-button" :class="class">
4
+ <view class="u-float-button__main" @click.stop="clickHandler" :style="{
5
+ backgroundColor: backgroundColor,
6
+ color: color,
7
+ flexDirection: 'row',
8
+ justifyContent: 'center',
9
+ alignItems: 'center',
10
+ width: width,
11
+ height: height,
12
+ position: 'absolute',
13
+ bottom: bottom,
14
+ right: right,
15
+ borderRadius: '50%',
16
+ borderColor: borderColor,
17
+ }">
18
+ <slot :showList="showList">
19
+ <up-icon :class="{'show-list': showList}" name="plus" :color="color"></up-icon>
20
+ </slot>
21
+ <slot name="list">
22
+ <view class="u-float-button__list" :style="{
23
+ bottom: bottom,
24
+ right: right
25
+ }">
26
+ <template v-for="item in list">
27
+ <view class="u-float-button__item" :style="{
28
+ backgroundColor: item?.bgColor || bgColor,
29
+ color: item?.color || color,
30
+ flexDirection: 'row',
31
+ justifyContent: 'center',
32
+ alignItems: 'center',
33
+ width: width,
34
+ height: height,
35
+ borderRadius: '50%',
36
+ borderColor: item?.borderColor || borderColor,
37
+ }" @click="itemClick(item, index)">
38
+ <up-icon :name="item.name" :color="item?.color || color"></up-icon>
39
+ </view>
40
+ </template>
41
+ </view>
42
+ </slot>
43
+ </view>
44
+ </view>
45
+ </template>
46
+
47
+ <script>
48
+ import { mpMixin } from '../../libs/mixin/mpMixin';
49
+ import { mixin } from '../../libs/mixin/mixin';
50
+ import { addStyle, addUnit, deepMerge } from '../../libs/function/index';
51
+ /**
52
+ * FloatButton 悬浮按钮
53
+ * @description 悬浮按钮常用于屏幕右下角点击展开的操作菜单
54
+ * @tutorial https://ijry.github.io/uview-plus/components/floatButton.html
55
+ * @property {String} bgColor 背景颜色
56
+ * @event {Function} click 点击触发事件
57
+ * @example <up-view></up-view>
58
+ */
59
+ export default {
60
+ name: 'u-float-button',
61
+ // #ifdef MP
62
+ mixins: [mpMixin, mixin],
63
+ // #endif
64
+ // #ifndef MP
65
+ mixins: [mpMixin, mixin],
66
+ // #endif
67
+ emits: ['click', 'item-click'],
68
+ computed: {
69
+ valueStyle() {}
70
+ },
71
+ props: {
72
+ bgColor: '#2979ff',
73
+ color: '#fff',
74
+ width: '50px',
75
+ height: '50px',
76
+ borderColor: '',
77
+ right: '80px',
78
+ bottom: '100px',
79
+ isMenu: false
80
+ },
81
+ data() {
82
+ return {
83
+ showList: false
84
+ }
85
+ },
86
+ methods: {
87
+ addStyle,
88
+ clickHandler(e) {
89
+ if (this.isMenu) {
90
+ this.showList = !this.showList
91
+ } else {
92
+ this.$emit('click', e)
93
+ }
94
+ },
95
+ itemClick(item, index) {
96
+ this.$emit('item-click', {
97
+ ...item,
98
+ index
99
+ })
100
+ }
101
+ }
102
+ }
103
+ </script>
104
+
105
+ <style lang="scss" scoped>
106
+ @import '../../libs/css/components.scss';
107
+
108
+ .u-float-button {
109
+ .show-list {
110
+ transform: rotate(45deg);
111
+ }
112
+ &__list {
113
+ position: absolute;
114
+ bottom: 0px;
115
+ display: flex;
116
+ flex-direction: column;
117
+ >view {
118
+ margin: 5px 0px;
119
+ }
120
+ }
121
+ }
122
+ </style>
@@ -2,6 +2,7 @@
2
2
  <u-transition
3
3
  mode="fade"
4
4
  :show="show"
5
+ :style="transStyle"
5
6
  :duration="fade ? 1000 : 0"
6
7
  >
7
8
  <view
@@ -129,6 +130,13 @@
129
130
  }
130
131
  },
131
132
  computed: {
133
+ transStyle() {
134
+ let style = {};
135
+ // 通过调用addUnit()方法,如果有单位,如百分比,px单位等,直接返回,如果是纯粹的数值,则加上rpx单位
136
+ style.width = addUnit(this.width);
137
+ style.height = addUnit(this.height);
138
+ return style;
139
+ },
132
140
  wrapStyle() {
133
141
  let style = {};
134
142
  // 通过调用addUnit()方法,如果有单位,如百分比,px单位等,直接返回,如果是纯粹的数值,则加上rpx单位
@@ -156,8 +164,8 @@
156
164
  methods: {
157
165
  addUnit,
158
166
  // 点击图片
159
- onClick() {
160
- this.$emit('click')
167
+ onClick(e) {
168
+ this.$emit('click', e)
161
169
  },
162
170
  // 图片加载失败
163
171
  onErrorHandler(err) {
@@ -192,7 +200,7 @@
192
200
  removeBgColor() {
193
201
  // 淡入动画过渡完成后,将背景设置为透明色,否则png图片会看到灰色的背景
194
202
  this.backgroundStyle = {
195
- backgroundColor: 'transparent'
203
+ backgroundColor: this.bgColor || '#ffffff'
196
204
  };
197
205
  }
198
206
  }
@@ -2,7 +2,7 @@
2
2
  <view
3
3
  class="u-radio-group"
4
4
  :class="bemClass"
5
- :style="radioGroupStyle"
5
+ :style="radioGroupStyle"
6
6
  >
7
7
  <slot></slot>
8
8
  </view>
@@ -12,6 +12,7 @@
12
12
  import { props } from './props';
13
13
  import { mpMixin } from '../../libs/mixin/mpMixin';
14
14
  import { mixin } from '../../libs/mixin/mixin';
15
+ import { addUnit, addStyle, deepMerge } from '../../libs/function/index';
15
16
 
16
17
  /**
17
18
  * radioRroup 单选框父组件
@@ -34,7 +35,7 @@
34
35
  * @property {Boolean} borderBottom placement为row时,是否显示下边框 (默认 false )
35
36
  * @property {String} iconPlacement 图标与文字的对齐方式 (默认 'left' )
36
37
  * @property {Object} gap item 之间的间距
37
- * @property {Object} customStyle 组件的样式,对象形式
38
+ * @property {Object} customStyle 组件的样式,对象形式
38
39
  * @event {Function} change 任一个radio状态发生变化时触发
39
40
  * @example <u-radio-group v-model="value"></u-radio-group>
40
41
  */
@@ -274,7 +274,7 @@
274
274
  // 触摸后第一次移动已经将status设置为moving状态,故触摸第二次移动不会触发本事件
275
275
  if (this.status == 'start') this.$emit('start');
276
276
  let touches = event.touches[0];
277
- console.log('touchs', touches)
277
+ // console.log('touchs', touches)
278
278
  // 滑块的左边不一定跟屏幕左边接壤,所以需要减去最外层父元素的左边值
279
279
  let clientX = 0;
280
280
  // #ifndef APP-NVUE
@@ -0,0 +1,73 @@
1
+ <template>
2
+ <view
3
+ class="u-view" :class="class" :style="{
4
+ backgroundColor: backgroundColor,
5
+ color: color,
6
+ flexDirection: flexDirection,
7
+ justifyContent: justifyContent,
8
+ alignItems: alignItems,
9
+ flex1: flex1,
10
+ width: width,
11
+ height: height,
12
+ padding: padding,
13
+ margin: margin,
14
+ borderColor: borderColor,
15
+ }">
16
+ </view>
17
+ </template>
18
+
19
+ <script>
20
+ import { mpMixin } from '../../libs/mixin/mpMixin';
21
+ import { mixin } from '../../libs/mixin/mixin';
22
+ import { addStyle, addUnit, deepMerge } from '../../libs/function/index';
23
+ /**
24
+ * View 视图
25
+ * @description 对View默认标签的封装
26
+ * @tutorial https://ijry.github.io/uview-plus/components/view.html
27
+ * @property {String} bgColor 背景颜色
28
+ * @event {Function} click 点击触发事件
29
+ * @example <up-view></up-view>
30
+ */
31
+ export default {
32
+ name: 'up-view',
33
+ // #ifdef MP
34
+ mixins: [mpMixin, mixin],
35
+ // #endif
36
+ // #ifndef MP
37
+ mixins: [mpMixin, mixin],
38
+ // #endif
39
+ emits: ['click'],
40
+ computed: {
41
+ valueStyle() {}
42
+ },
43
+ props: {
44
+ backgroundColor: '',
45
+ color: '',
46
+ flexDirection: '',
47
+ justifyContent: '',
48
+ alignItems: '',
49
+ flex1: '',
50
+ width: '',
51
+ height: '',
52
+ padding: '',
53
+ margin: '',
54
+ borderColor: ''
55
+ },
56
+ data() {
57
+ return {}
58
+ },
59
+ methods: {
60
+ addStyle,
61
+ clickHandler() {
62
+ this.$emit('click')
63
+ }
64
+ }
65
+ }
66
+ </script>
67
+
68
+ <style lang="scss" scoped>
69
+ @import '../../libs/css/components.scss';
70
+
71
+ .u-view {
72
+ }
73
+ </style>
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "id": "uview-plus",
3
3
  "name": "uview-plus",
4
4
  "displayName": "零云®uview-plus3.0重磅发布,全面的Vue3移动组件库。",
5
- "version": "3.3.40",
5
+ "version": "3.3.42",
6
6
  "description": "零云®uview-plus已兼容vue3,全面的组件和便捷的工具会让您信手拈来,如鱼得水",
7
7
  "keywords": [
8
8
  "uview",