uview-plus 3.4.53 → 3.4.54
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 +5 -0
- package/components/u-dropdown/u-dropdown.vue +11 -7
- package/components/u-icon/u-icon.vue +2 -48
- package/components/u-icon/util.js +6 -4
- package/index.js +4 -1
- package/package.json +1 -1
package/changelog.md
CHANGED
|
@@ -8,13 +8,13 @@
|
|
|
8
8
|
<view class="u-dropdown__menu__item" v-for="(item, index) in menuList" :key="index" @tap.stop="menuClick(index)">
|
|
9
9
|
<view class="u-flex u-flex-row">
|
|
10
10
|
<text class="u-dropdown__menu__item__text" :style="{
|
|
11
|
-
color: item.disabled ? '#c0c4cc' : (index === current ||
|
|
11
|
+
color: item.disabled ? '#c0c4cc' : (index === current || highlightIndexList.includes(index)) ? activeColor : inactiveColor,
|
|
12
12
|
fontSize: addUnit(titleSize)
|
|
13
13
|
}">{{item.title}}</text>
|
|
14
14
|
<view class="u-dropdown__menu__item__arrow" :class="{
|
|
15
15
|
'u-dropdown__menu__item__arrow--rotate': index === current
|
|
16
16
|
}">
|
|
17
|
-
<u-icon :custom-style="{display: 'flex'}" :name="menuIcon" :size="addUnit(menuIconSize)" :color="index === current ||
|
|
17
|
+
<u-icon :custom-style="{display: 'flex'}" :name="menuIcon" :size="addUnit(menuIconSize)" :color="index === current || highlightIndexList.includes(index) ? activeColor : '#c0c4cc'"></u-icon>
|
|
18
18
|
</view>
|
|
19
19
|
</view>
|
|
20
20
|
</view>
|
|
@@ -71,8 +71,8 @@
|
|
|
71
71
|
zIndex: -1,
|
|
72
72
|
opacity: 0
|
|
73
73
|
},
|
|
74
|
-
//
|
|
75
|
-
|
|
74
|
+
// 让某些菜单保持高亮的状态
|
|
75
|
+
highlightIndexList: [],
|
|
76
76
|
contentHeight: 0
|
|
77
77
|
}
|
|
78
78
|
},
|
|
@@ -160,9 +160,13 @@
|
|
|
160
160
|
if (!this.closeOnClickMask) return;
|
|
161
161
|
this.close();
|
|
162
162
|
},
|
|
163
|
-
//
|
|
164
|
-
highlight(
|
|
165
|
-
|
|
163
|
+
// 外部手动设置某些菜单高亮
|
|
164
|
+
highlight(indexParams = undefined) {
|
|
165
|
+
if (Array.isArray(indexParams)) {
|
|
166
|
+
this.highlightIndexList = [...indexParams];
|
|
167
|
+
return;
|
|
168
|
+
}
|
|
169
|
+
this.highlightIndexList = indexParams !== undefined ? [indexParams] : [];
|
|
166
170
|
},
|
|
167
171
|
// 获取下拉菜单内容的高度
|
|
168
172
|
getContentHeight() {
|
|
@@ -42,6 +42,7 @@
|
|
|
42
42
|
import { mpMixin } from '../../libs/mixin/mpMixin';
|
|
43
43
|
import { mixin } from '../../libs/mixin/mixin';
|
|
44
44
|
import { addUnit, addStyle } from '../../libs/function/index';
|
|
45
|
+
import fontUtil from './util';
|
|
45
46
|
/**
|
|
46
47
|
* icon 图标
|
|
47
48
|
* @description 基于字体的图标集,包含了大多数常见场景的图标。
|
|
@@ -71,54 +72,7 @@
|
|
|
71
72
|
export default {
|
|
72
73
|
name: 'u-icon',
|
|
73
74
|
beforeCreate() {
|
|
74
|
-
|
|
75
|
-
// #ifdef APP-NVUE
|
|
76
|
-
// nvue通过weex的dom模块引入字体,相关文档地址如下:
|
|
77
|
-
// https://weex.apache.org/zh/docs/modules/dom.html#addrule
|
|
78
|
-
const domModule = weex.requireModule('dom');
|
|
79
|
-
domModule.addRule('fontFace', {
|
|
80
|
-
'fontFamily': "uicon-iconfont",
|
|
81
|
-
'src': `url('${config.iconUrl}')`
|
|
82
|
-
});
|
|
83
|
-
if (config.customIcon.family) {
|
|
84
|
-
domModule.addRule('fontFace', {
|
|
85
|
-
'fontFamily': config.customIcon.family,
|
|
86
|
-
'src': `url('${config.customIcon.url}')`
|
|
87
|
-
});
|
|
88
|
-
}
|
|
89
|
-
// #endif
|
|
90
|
-
// #ifdef APP || H5 || MP-WEIXIN || MP-ALIPAY
|
|
91
|
-
uni.loadFontFace({
|
|
92
|
-
family: 'uicon-iconfont',
|
|
93
|
-
source: 'url("' + config.iconUrl + '")',
|
|
94
|
-
success() {
|
|
95
|
-
// console.log('内置字体图标加载成功');
|
|
96
|
-
},
|
|
97
|
-
fail() {
|
|
98
|
-
// console.error('内置字体图标加载出错');
|
|
99
|
-
}
|
|
100
|
-
});
|
|
101
|
-
if (config.customIcon.family) {
|
|
102
|
-
uni.loadFontFace({
|
|
103
|
-
family: config.customIcon.family,
|
|
104
|
-
source: 'url("' + config.customIcon.url + '")',
|
|
105
|
-
success() {
|
|
106
|
-
// console.log('扩展字体图标加载成功');
|
|
107
|
-
},
|
|
108
|
-
fail() {
|
|
109
|
-
// console.error('扩展字体图标加载出错');
|
|
110
|
-
}
|
|
111
|
-
});
|
|
112
|
-
}
|
|
113
|
-
// #endif
|
|
114
|
-
// #ifdef APP-NVUE
|
|
115
|
-
if (this.customFontFamily) {
|
|
116
|
-
domModule.addRule('fontFace', {
|
|
117
|
-
'fontFamily': `${this.customPrefix}-${this.customFontFamily}`,
|
|
118
|
-
'src': `url('${this.customFontUrl}')`
|
|
119
|
-
})
|
|
120
|
-
}
|
|
121
|
-
// #endif
|
|
75
|
+
fontUtil.loadFont();
|
|
122
76
|
},
|
|
123
77
|
data() {
|
|
124
78
|
return {
|
|
@@ -7,7 +7,7 @@ function once(fn) {
|
|
|
7
7
|
return function(...args) {
|
|
8
8
|
if (!called) {
|
|
9
9
|
result = fn.apply(this, args);
|
|
10
|
-
|
|
10
|
+
called = true;
|
|
11
11
|
}
|
|
12
12
|
return result;
|
|
13
13
|
};
|
|
@@ -15,7 +15,7 @@ function once(fn) {
|
|
|
15
15
|
|
|
16
16
|
// 使用高阶函数
|
|
17
17
|
const loadFont = once(() => {
|
|
18
|
-
console.log('这个函数只能执行一次');
|
|
18
|
+
// console.log('这个函数只能执行一次');
|
|
19
19
|
// #ifdef APP-NVUE
|
|
20
20
|
// nvue通过weex的dom模块引入字体,相关文档地址如下:
|
|
21
21
|
// https://weex.apache.org/zh/docs/modules/dom.html#addrule
|
|
@@ -33,6 +33,7 @@ const loadFont = once(() => {
|
|
|
33
33
|
// #endif
|
|
34
34
|
// #ifdef APP || H5 || MP-WEIXIN || MP-ALIPAY
|
|
35
35
|
uni.loadFontFace({
|
|
36
|
+
global: true, // 是否全局生效。微信小程序 '2.10.0'起支持全局生效,需在 app.vue 中调用。
|
|
36
37
|
family: 'uicon-iconfont',
|
|
37
38
|
source: 'url("' + config.iconUrl + '")',
|
|
38
39
|
success() {
|
|
@@ -44,6 +45,7 @@ const loadFont = once(() => {
|
|
|
44
45
|
});
|
|
45
46
|
if (config.customIcon.family) {
|
|
46
47
|
uni.loadFontFace({
|
|
48
|
+
global: true, // 是否全局生效。微信小程序 '2.10.0'起支持全局生效,需在 app.vue 中调用。
|
|
47
49
|
family: config.customIcon.family,
|
|
48
50
|
source: 'url("' + config.customIcon.url + '")',
|
|
49
51
|
success() {
|
|
@@ -66,8 +68,8 @@ const loadFont = once(() => {
|
|
|
66
68
|
return true;
|
|
67
69
|
});
|
|
68
70
|
|
|
69
|
-
let
|
|
71
|
+
let fontUtil = {
|
|
70
72
|
loadFont
|
|
71
73
|
}
|
|
72
74
|
|
|
73
|
-
export default
|
|
75
|
+
export default fontUtil
|
package/index.js
CHANGED
|
@@ -38,9 +38,12 @@ import platform from './libs/function/platform'
|
|
|
38
38
|
// http
|
|
39
39
|
import http from './libs/function/http.js'
|
|
40
40
|
|
|
41
|
+
// fontUtil
|
|
42
|
+
import fontUtil from './components/u-icon/util.js';
|
|
43
|
+
|
|
41
44
|
// 导出
|
|
42
45
|
let themeType = ['primary', 'success', 'error', 'warning', 'info'];
|
|
43
|
-
export { route, http, debounce, throttle, calc, digit, platform, themeType, mixin, mpMixin, props, color, test, zIndex }
|
|
46
|
+
export { route, http, debounce, throttle, calc, digit, platform, themeType, mixin, mpMixin, props, color, test, zIndex, fontUtil }
|
|
44
47
|
export * from './libs/function/index.js'
|
|
45
48
|
export * from './libs/function/colorGradient.js'
|
|
46
49
|
|
package/package.json
CHANGED