uview-plus 3.3.74 → 3.4.1
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 +4 -0
- package/index.js +16 -4
- package/libs/config/props.js +30 -6
- package/libs/function/http.js +4 -0
- package/libs/luch-request/core/Request.js +2 -1
- package/package.json +1 -1
package/changelog.md
CHANGED
package/index.js
CHANGED
|
@@ -5,8 +5,6 @@
|
|
|
5
5
|
import { mixin } from './libs/mixin/mixin.js'
|
|
6
6
|
// 小程序特有的mixin
|
|
7
7
|
import { mpMixin } from './libs/mixin/mpMixin.js'
|
|
8
|
-
// 全局挂载引入http相关请求拦截插件
|
|
9
|
-
import Request from './libs/luch-request'
|
|
10
8
|
|
|
11
9
|
// 路由封装
|
|
12
10
|
import route from './libs/util/route.js'
|
|
@@ -33,8 +31,10 @@ import color from './libs/config/color.js'
|
|
|
33
31
|
// 平台
|
|
34
32
|
import platform from './libs/function/platform'
|
|
35
33
|
|
|
34
|
+
// http
|
|
35
|
+
import http from './libs/function/http.js'
|
|
36
|
+
|
|
36
37
|
// 导出
|
|
37
|
-
const http = new Request()
|
|
38
38
|
let themeType = ['primary', 'success', 'error', 'warning', 'info'];
|
|
39
39
|
export { route, http, debounce, throttle, platform, themeType, mixin, mpMixin, props, color, test, zIndex }
|
|
40
40
|
export * from './libs/function/index.js'
|
|
@@ -107,13 +107,25 @@ function toCamelCase(str) {
|
|
|
107
107
|
});
|
|
108
108
|
}
|
|
109
109
|
|
|
110
|
-
const install = (Vue) => {
|
|
110
|
+
const install = (Vue, upuiParams = '') => {
|
|
111
111
|
// #ifdef H5
|
|
112
112
|
components.forEach(function(component) {
|
|
113
113
|
const name = component.name.replace(/u-([a-zA-Z0-9-_]+)/g, 'up-$1');
|
|
114
114
|
Vue.component(name, component);
|
|
115
115
|
});
|
|
116
116
|
// #endif
|
|
117
|
+
|
|
118
|
+
// 初始化
|
|
119
|
+
if (upuiParams) {
|
|
120
|
+
uni.upuiParams = upuiParams
|
|
121
|
+
let temp = upuiParams()
|
|
122
|
+
if (temp.httpIns) {
|
|
123
|
+
temp.httpIns(http)
|
|
124
|
+
}
|
|
125
|
+
if (temp.options) {
|
|
126
|
+
setConfig(temp.options)
|
|
127
|
+
}
|
|
128
|
+
}
|
|
117
129
|
|
|
118
130
|
// 同时挂载到uni和Vue.prototype中
|
|
119
131
|
// $u挂载到uni对象上
|
package/libs/config/props.js
CHANGED
|
@@ -4,7 +4,14 @@
|
|
|
4
4
|
* 无需在每个引入组件的页面中都配置一次
|
|
5
5
|
*/
|
|
6
6
|
import config from './config'
|
|
7
|
-
|
|
7
|
+
// 各个需要fixed的地方的z-index配置文件
|
|
8
|
+
import zIndex from './zIndex.js'
|
|
9
|
+
// 关于颜色的配置,特殊场景使用
|
|
10
|
+
import color from './color.js'
|
|
11
|
+
// http
|
|
12
|
+
import http from '../function/http.js'
|
|
13
|
+
import { shallowMerge } from '../function/index.js'
|
|
14
|
+
// 组件props
|
|
8
15
|
import ActionSheet from '../../components/u-action-sheet/actionSheet'
|
|
9
16
|
import Album from '../../components/u-album/album'
|
|
10
17
|
import Alert from '../../components/u-alert/alert'
|
|
@@ -94,11 +101,7 @@ import Tooltip from '../../components/u-tooltip/tooltip'
|
|
|
94
101
|
import Transition from '../../components/u-transition/transition'
|
|
95
102
|
import Upload from '../../components/u-upload/upload'
|
|
96
103
|
|
|
97
|
-
const {
|
|
98
|
-
color
|
|
99
|
-
} = config
|
|
100
|
-
|
|
101
|
-
export default {
|
|
104
|
+
const props = {
|
|
102
105
|
...ActionSheet,
|
|
103
106
|
...Album,
|
|
104
107
|
...Alert,
|
|
@@ -188,3 +191,24 @@ export default {
|
|
|
188
191
|
...Transition,
|
|
189
192
|
...Upload
|
|
190
193
|
}
|
|
194
|
+
|
|
195
|
+
function setConfig(configs) {
|
|
196
|
+
shallowMerge(config, configs.config || {})
|
|
197
|
+
shallowMerge(props, configs.props || {})
|
|
198
|
+
shallowMerge(color, configs.color || {})
|
|
199
|
+
shallowMerge(zIndex, configs.zIndex || {})
|
|
200
|
+
}
|
|
201
|
+
|
|
202
|
+
// 初始化自定义配置
|
|
203
|
+
if (uni && uni.upuiParams) {
|
|
204
|
+
console.log('setting uview-plus')
|
|
205
|
+
let temp = uni.upuiParams()
|
|
206
|
+
if (temp.httpIns) {
|
|
207
|
+
temp.httpIns(http)
|
|
208
|
+
}
|
|
209
|
+
if (temp.options) {
|
|
210
|
+
setConfig(temp.options)
|
|
211
|
+
}
|
|
212
|
+
}
|
|
213
|
+
|
|
214
|
+
export default props
|
|
@@ -33,7 +33,8 @@ export default class Request {
|
|
|
33
33
|
* @param {Boolean} arg.firstIpv4 - 全DNS解析时优先使用ipv4。默认false。仅 App-Android 支持 (HBuilderX 2.8.0+)
|
|
34
34
|
* @param {Function(statusCode):Boolean} arg.validateStatus - 全局默认的自定义验证器。默认statusCode >= 200 && statusCode < 300
|
|
35
35
|
*/
|
|
36
|
-
constructor(arg = {}) {
|
|
36
|
+
constructor(arg = {}) {
|
|
37
|
+
// console.info('初始化luch-request')
|
|
37
38
|
if (!isPlainObject(arg)) {
|
|
38
39
|
arg = {}
|
|
39
40
|
console.warn('设置全局参数必须接收一个Object')
|
package/package.json
CHANGED