uview-plus 3.4.13 → 3.4.15
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 +13 -0
- package/components/u-dropdown/u-dropdown.vue +8 -7
- package/components/u-icon/u-icon.vue +36 -12
- package/components/u-modal/modal.js +2 -1
- package/components/u-modal/props.js +5 -0
- package/components/u-modal/u-modal.vue +8 -3
- package/components/u-picker-data/u-picker-data.vue +1 -1
- package/components/u-sticky/u-sticky.vue +5 -0
- package/components/u-swiper/u-swiper.vue +1 -1
- package/index.js +4 -1
- package/libs/config/config.js +8 -0
- package/libs/function/calc.js +64 -0
- package/package.json +1 -1
package/changelog.md
CHANGED
|
@@ -1,3 +1,16 @@
|
|
|
1
|
+
## 3.4.15(2025-04-10)
|
|
2
|
+
improvment: 优化移步加载数据时swiper组件displayMultipleItems报错
|
|
3
|
+
|
|
4
|
+
feat: modal增加contentStyle属性
|
|
5
|
+
|
|
6
|
+
fix: 修复下拉菜单收起动画缺失
|
|
7
|
+
|
|
8
|
+
fix: 修复sticky的offset属性值为响应式数据时失效 #237
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
## 3.4.14(2025-04-09)
|
|
12
|
+
feat: 支持自托管内置图标及扩展自定义图标
|
|
13
|
+
|
|
1
14
|
## 3.4.13(2025-04-08)
|
|
2
15
|
fix: tabs点击当前tab触发change事件
|
|
3
16
|
|
|
@@ -20,11 +20,12 @@
|
|
|
20
20
|
</view>
|
|
21
21
|
</view>
|
|
22
22
|
<view class="u-dropdown__content" :style="[contentStyle, {
|
|
23
|
-
transition: `opacity ${duration / 1000}s linear`,
|
|
23
|
+
transition: `opacity ${duration / 1000}s, z-index ${duration / 1000}s linear`,
|
|
24
24
|
top: addUnit(height)
|
|
25
25
|
}]"
|
|
26
26
|
@tap="maskClick" @touchmove.stop.prevent>
|
|
27
|
-
<view @tap.stop.prevent class="u-dropdown__content__popup" :style="[popupStyle
|
|
27
|
+
<view @tap.stop.prevent class="u-dropdown__content__popup" :style="[popupStyle, {
|
|
28
|
+
}]">
|
|
28
29
|
<slot></slot>
|
|
29
30
|
</view>
|
|
30
31
|
<view class="u-dropdown__content__mask"></view>
|
|
@@ -147,11 +148,11 @@
|
|
|
147
148
|
this.active = false;
|
|
148
149
|
this.current = 99999;
|
|
149
150
|
// 下拉内容的样式进行调整,不透明度设置为0
|
|
150
|
-
this.contentStyle =
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
height
|
|
154
|
-
}
|
|
151
|
+
this.contentStyle.zIndex = -1;
|
|
152
|
+
this.contentStyle.opacity = 0;
|
|
153
|
+
setTimeout(() => {
|
|
154
|
+
this.contentStyle.height = 0;
|
|
155
|
+
}, this.duration)
|
|
155
156
|
},
|
|
156
157
|
// 点击遮罩
|
|
157
158
|
maskClick() {
|
|
@@ -35,24 +35,47 @@
|
|
|
35
35
|
</template>
|
|
36
36
|
|
|
37
37
|
<script>
|
|
38
|
+
import config from '../../libs/config/config';
|
|
38
39
|
// #ifdef APP-NVUE
|
|
39
40
|
// nvue通过weex的dom模块引入字体,相关文档地址如下:
|
|
40
41
|
// https://weex.apache.org/zh/docs/modules/dom.html#addrule
|
|
41
|
-
const
|
|
42
|
-
const domModule = weex.requireModule('dom')
|
|
42
|
+
const domModule = weex.requireModule('dom');
|
|
43
43
|
domModule.addRule('fontFace', {
|
|
44
44
|
'fontFamily': "uicon-iconfont",
|
|
45
|
-
'src': `url('${
|
|
46
|
-
})
|
|
45
|
+
'src': `url('${config.iconUrl}')`
|
|
46
|
+
});
|
|
47
|
+
// #endif
|
|
48
|
+
// #ifdef APP || H5 || MP-WEIXIN || MP-ALIPAY
|
|
49
|
+
uni.loadFontFace({
|
|
50
|
+
family: 'uicon-iconfont',
|
|
51
|
+
source: 'url("' + config.iconUrl + '")',
|
|
52
|
+
success() {
|
|
53
|
+
// console.log('内置字体图标加载成功');
|
|
54
|
+
},
|
|
55
|
+
fail() {
|
|
56
|
+
console.error('内置字体图标加载出错');
|
|
57
|
+
}
|
|
58
|
+
});
|
|
59
|
+
if (config.customIcon.family) {
|
|
60
|
+
uni.loadFontFace({
|
|
61
|
+
family: config.customIcon.family,
|
|
62
|
+
source: 'url("' + config.customIcon.url + '")',
|
|
63
|
+
success() {
|
|
64
|
+
// console.log('扩展字体图标加载成功');
|
|
65
|
+
},
|
|
66
|
+
fail() {
|
|
67
|
+
console.error('扩展字体图标加载出错');
|
|
68
|
+
}
|
|
69
|
+
});
|
|
70
|
+
}
|
|
47
71
|
// #endif
|
|
48
72
|
|
|
49
73
|
// 引入图标名称,已经对应的unicode
|
|
50
|
-
import icons from './icons'
|
|
74
|
+
import icons from './icons';
|
|
51
75
|
import { props } from './props';
|
|
52
76
|
import { mpMixin } from '../../libs/mixin/mpMixin';
|
|
53
77
|
import { mixin } from '../../libs/mixin/mixin';
|
|
54
78
|
import { addUnit, addStyle } from '../../libs/function/index';
|
|
55
|
-
import config from '../../libs/config/config';
|
|
56
79
|
/**
|
|
57
80
|
* icon 图标
|
|
58
81
|
* @description 基于字体的图标集,包含了大多数常见场景的图标。
|
|
@@ -93,7 +116,6 @@
|
|
|
93
116
|
},
|
|
94
117
|
data() {
|
|
95
118
|
return {
|
|
96
|
-
|
|
97
119
|
}
|
|
98
120
|
},
|
|
99
121
|
emits: ['click'],
|
|
@@ -102,7 +124,7 @@
|
|
|
102
124
|
uClasses() {
|
|
103
125
|
let classes = []
|
|
104
126
|
classes.push(this.customPrefix + '-' + this.name)
|
|
105
|
-
//
|
|
127
|
+
// uview-plus内置图标类名为u-iconfont
|
|
106
128
|
if (this.customPrefix == 'uicon') {
|
|
107
129
|
classes.push('u-iconfont')
|
|
108
130
|
} else {
|
|
@@ -127,6 +149,9 @@
|
|
|
127
149
|
// 某些特殊情况需要设置一个到顶部的距离,才能更好的垂直居中
|
|
128
150
|
top: addUnit(this.top)
|
|
129
151
|
}
|
|
152
|
+
if (this.customPrefix !== 'uicon') {
|
|
153
|
+
style.fontFamily = this.customPrefix
|
|
154
|
+
}
|
|
130
155
|
// 非主题色值时,才当作颜色值
|
|
131
156
|
if (this.color && !config.type.includes(this.color)) style.color = this.color
|
|
132
157
|
|
|
@@ -147,7 +172,7 @@
|
|
|
147
172
|
icon() {
|
|
148
173
|
// 使用自定义图标的时候页面上会把name属性也展示出来,所以在这里处理一下
|
|
149
174
|
if (this.customPrefix !== "uicon") {
|
|
150
|
-
return
|
|
175
|
+
return config.customIcons[this.name] || this.name;
|
|
151
176
|
}
|
|
152
177
|
// 如果内置的图标中找不到对应的图标,就直接返回name值,因为用户可能传入的是unicode代码
|
|
153
178
|
return icons['uicon-' + this.name] || this.name
|
|
@@ -176,13 +201,12 @@
|
|
|
176
201
|
$u-icon-error: $u-error !default;
|
|
177
202
|
$u-icon-label-line-height:1 !default;
|
|
178
203
|
|
|
179
|
-
/* #
|
|
180
|
-
//
|
|
204
|
+
/* #ifdef MP-QQ || MP-TOUTIAO || MP-BAIDU || MP-KUAISHOU || MP-XHS */
|
|
205
|
+
// 2025/04/09在App/微信/支付宝/鸿蒙元服务已改用uni.loadFontFace加载字体
|
|
181
206
|
@font-face {
|
|
182
207
|
font-family: 'uicon-iconfont';
|
|
183
208
|
src: url('https://at.alicdn.com/t/font_2225171_8kdcwk4po24.ttf') format('truetype');
|
|
184
209
|
}
|
|
185
|
-
|
|
186
210
|
/* #endif */
|
|
187
211
|
|
|
188
212
|
.u-icon {
|
|
@@ -26,9 +26,7 @@
|
|
|
26
26
|
>{{ title }}</view>
|
|
27
27
|
<view
|
|
28
28
|
class="u-modal__content"
|
|
29
|
-
:style="
|
|
30
|
-
paddingTop: `${title ? 12 : 25}px`
|
|
31
|
-
}"
|
|
29
|
+
:style="contentStyleCpu"
|
|
32
30
|
>
|
|
33
31
|
<slot>
|
|
34
32
|
<text class="u-modal__content__text" :style="{textAlign: contentTextAlign}">
|
|
@@ -138,6 +136,13 @@
|
|
|
138
136
|
}
|
|
139
137
|
},
|
|
140
138
|
emits: ["confirm", "cancel", "close", "update:show", 'cancelOnAsync'],
|
|
139
|
+
computed: {
|
|
140
|
+
contentStyleCpu() {
|
|
141
|
+
let style = this.contentStyle;
|
|
142
|
+
style.paddingTop = `${title ? 12 : 25}px`
|
|
143
|
+
return style;
|
|
144
|
+
}
|
|
145
|
+
},
|
|
141
146
|
methods: {
|
|
142
147
|
addUnit,
|
|
143
148
|
// 点击确定按钮
|
|
@@ -30,7 +30,7 @@
|
|
|
30
30
|
:previousMargin="addUnit(previousMargin)"
|
|
31
31
|
:nextMargin="addUnit(nextMargin)"
|
|
32
32
|
:acceleration="acceleration"
|
|
33
|
-
:displayMultipleItems="displayMultipleItems"
|
|
33
|
+
:displayMultipleItems="list.length > 0 ? displayMultipleItems : 0"
|
|
34
34
|
:easingFunction="easingFunction"
|
|
35
35
|
>
|
|
36
36
|
<swiper-item
|
package/index.js
CHANGED
|
@@ -17,6 +17,8 @@ import test from './libs/function/test.js'
|
|
|
17
17
|
import debounce from './libs/function/debounce.js'
|
|
18
18
|
// 节流方法
|
|
19
19
|
import throttle from './libs/function/throttle.js'
|
|
20
|
+
// 浮点计算
|
|
21
|
+
import calc from './libs/function/calc.js'
|
|
20
22
|
// 公共文件写入的方法
|
|
21
23
|
import index from './libs/function/index.js'
|
|
22
24
|
|
|
@@ -36,7 +38,7 @@ import http from './libs/function/http.js'
|
|
|
36
38
|
|
|
37
39
|
// 导出
|
|
38
40
|
let themeType = ['primary', 'success', 'error', 'warning', 'info'];
|
|
39
|
-
export { route, http, debounce, throttle, platform, themeType, mixin, mpMixin, props, color, test, zIndex }
|
|
41
|
+
export { route, http, debounce, throttle, calc, platform, themeType, mixin, mpMixin, props, color, test, zIndex }
|
|
40
42
|
export * from './libs/function/index.js'
|
|
41
43
|
export * from './libs/function/colorGradient.js'
|
|
42
44
|
|
|
@@ -69,6 +71,7 @@ const $u = {
|
|
|
69
71
|
zIndex,
|
|
70
72
|
debounce,
|
|
71
73
|
throttle,
|
|
74
|
+
calc,
|
|
72
75
|
mixin,
|
|
73
76
|
mpMixin,
|
|
74
77
|
props,
|
package/libs/config/config.js
CHANGED
|
@@ -37,6 +37,14 @@ export default {
|
|
|
37
37
|
'up-tips-color': '#909399',
|
|
38
38
|
'up-light-color': '#c0c4cc'
|
|
39
39
|
},
|
|
40
|
+
// 字体图标地址
|
|
41
|
+
iconUrl: 'https://at.alicdn.com/t/font_2225171_8kdcwk4po24.ttf',
|
|
42
|
+
// 自定义图标
|
|
43
|
+
customIcon: {
|
|
44
|
+
family: '',
|
|
45
|
+
url: ''
|
|
46
|
+
},
|
|
47
|
+
customIcons: {}, // 自定义图标与unicode对应关系
|
|
40
48
|
// 默认单位,可以通过配置为rpx,那么在用于传入组件大小参数为数值时,就默认为rpx
|
|
41
49
|
unit: 'px',
|
|
42
50
|
// 拦截器
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
// 浮点数加法
|
|
2
|
+
export function add (arg1, arg2) {
|
|
3
|
+
var r1, r2, m
|
|
4
|
+
try {
|
|
5
|
+
r1 = arg1.toString().split('.')[1].length
|
|
6
|
+
} catch (e) {
|
|
7
|
+
r1 = 0
|
|
8
|
+
}
|
|
9
|
+
try {
|
|
10
|
+
r2 = arg2.toString().split('.')[1].length
|
|
11
|
+
} catch (e) {
|
|
12
|
+
r2 = 0
|
|
13
|
+
}
|
|
14
|
+
m = Math.pow(10, Math.max(r1, r2))
|
|
15
|
+
return (arg1 * m + arg2 * m) / m
|
|
16
|
+
}
|
|
17
|
+
// 浮点数减法
|
|
18
|
+
export function sub (arg1, arg2) {
|
|
19
|
+
var r1, r2, m, n
|
|
20
|
+
try {
|
|
21
|
+
r1 = arg1.toString().split('.')[1].length
|
|
22
|
+
} catch (e) {
|
|
23
|
+
r1 = 0
|
|
24
|
+
}
|
|
25
|
+
try {
|
|
26
|
+
r2 = arg2.toString().split('.')[1].length
|
|
27
|
+
} catch (e) {
|
|
28
|
+
r2 = 0
|
|
29
|
+
}
|
|
30
|
+
m = Math.pow(10, Math.max(r1, r2))
|
|
31
|
+
n = (r1 >= r2) ? r1 : r2
|
|
32
|
+
return Math.abs(((arg1 * m - arg2 * m) / m).toFixed(n))
|
|
33
|
+
}
|
|
34
|
+
//浮点乘法
|
|
35
|
+
export function mul (a, b) {
|
|
36
|
+
var c = 0,
|
|
37
|
+
d = a.toString(),
|
|
38
|
+
e = b.toString();
|
|
39
|
+
try {
|
|
40
|
+
c += d.split(".")[1].length;
|
|
41
|
+
} catch (f) {}
|
|
42
|
+
try {
|
|
43
|
+
c += e.split(".")[1].length;
|
|
44
|
+
} catch (f) {}
|
|
45
|
+
return Number(d.replace(".", "")) * Number(e.replace(".", "")) / Math.pow(10, c);
|
|
46
|
+
}
|
|
47
|
+
//浮点除法
|
|
48
|
+
export function div (a, b) {
|
|
49
|
+
var c, d, e = 0,
|
|
50
|
+
f = 0;
|
|
51
|
+
try {
|
|
52
|
+
e = a.toString().split(".")[1].length;
|
|
53
|
+
} catch (g) {}
|
|
54
|
+
try {
|
|
55
|
+
f = b.toString().split(".")[1].length;
|
|
56
|
+
} catch (g) {}
|
|
57
|
+
return c = Number(a.toString().replace(".", "")), d = Number(b.toString().replace(".", "")), xyutil.mul(c / d, Math.pow(10, f - e));
|
|
58
|
+
}
|
|
59
|
+
export default {
|
|
60
|
+
add,
|
|
61
|
+
sub,
|
|
62
|
+
mul,
|
|
63
|
+
div
|
|
64
|
+
}
|
package/package.json
CHANGED