nvue3 1.1.20 → 1.1.21
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/package.json +1 -1
- package/src/kernel.js +3 -3
- package/src/soft.js +12 -20
package/package.json
CHANGED
package/src/kernel.js
CHANGED
|
@@ -24,15 +24,15 @@ export default {
|
|
|
24
24
|
|
|
25
25
|
for (let k in librarys) {
|
|
26
26
|
const key = `\$${k}`;
|
|
27
|
-
const obj = new librarys[k](app);
|
|
27
|
+
const obj = new librarys[k](app, config);
|
|
28
28
|
app.config.globalProperties[key] = obj;
|
|
29
29
|
app.provide(key, obj);
|
|
30
30
|
}
|
|
31
31
|
|
|
32
|
-
const page = new pageClass(config.maps);
|
|
32
|
+
const page = new pageClass(config.maps || {});
|
|
33
33
|
app.config.globalProperties.$pages = page;
|
|
34
34
|
|
|
35
|
-
const soft = new softClass(
|
|
35
|
+
const soft = new softClass();
|
|
36
36
|
app.config.globalProperties.$soft = soft;
|
|
37
37
|
app.provide('$soft', soft);
|
|
38
38
|
app.provide('$size', soft.size);
|
package/src/soft.js
CHANGED
|
@@ -10,6 +10,8 @@ export default class {
|
|
|
10
10
|
singlePage = false; //是否从朋友圈进入的单页模式
|
|
11
11
|
|
|
12
12
|
// #ifdef APP-PLUS
|
|
13
|
+
os = '';
|
|
14
|
+
ua = '';
|
|
13
15
|
packName = ''; //APP包名
|
|
14
16
|
appid = ''; //小程序的APPID,H5和APP为在manifest中设置的appid
|
|
15
17
|
name = ''; //应用名称,即在manifest中设置的应用名称
|
|
@@ -34,13 +36,13 @@ export default class {
|
|
|
34
36
|
navbar: 0,
|
|
35
37
|
};
|
|
36
38
|
|
|
37
|
-
constructor(
|
|
39
|
+
constructor() {
|
|
38
40
|
try {
|
|
39
41
|
|
|
40
42
|
// #ifdef MP-WEIXIN
|
|
41
43
|
const { scene } = uni.getLaunchOptionsSync();
|
|
42
44
|
this.singlePage = (scene === 1154);
|
|
43
|
-
console.log('weixin.singlePage=', this.singlePage, scene);
|
|
45
|
+
// console.log('weixin.singlePage=', this.singlePage, scene);
|
|
44
46
|
// #endif
|
|
45
47
|
|
|
46
48
|
// console.log('soft start')
|
|
@@ -76,7 +78,7 @@ export default class {
|
|
|
76
78
|
this.size.top = windows.statusBarHeight || 25; //顶部状态栏高度,css中直接用var(--status-bar-height)
|
|
77
79
|
this.size.ratio = windows.pixelRatio; //设备像素比
|
|
78
80
|
|
|
79
|
-
this.size.navigation =
|
|
81
|
+
this.size.navigation = 44; //导航栏高度
|
|
80
82
|
this.size.bodyHeight = windows.screenHeight - this.size.top - this.size.navigation; //除去顶部和菜单的高度
|
|
81
83
|
}
|
|
82
84
|
else {
|
|
@@ -90,7 +92,7 @@ export default class {
|
|
|
90
92
|
this.size.screenHeight = system.screenHeight;
|
|
91
93
|
this.size.width = system.windowWidth; //屏幕尺寸
|
|
92
94
|
this.size.height = system.windowHeight;
|
|
93
|
-
this.size.navigation =
|
|
95
|
+
this.size.navigation = 44; //导航栏高度
|
|
94
96
|
this.size.bodyHeight = system.screenHeight - this.size.top - this.size.navigation; //除去顶部和菜单的高度
|
|
95
97
|
}
|
|
96
98
|
// #endif
|
|
@@ -117,7 +119,7 @@ export default class {
|
|
|
117
119
|
this.size.screenHeight = system.screenHeight;
|
|
118
120
|
this.size.width = system.windowWidth; //屏幕尺寸
|
|
119
121
|
this.size.height = system.windowHeight;
|
|
120
|
-
this.size.navigation =
|
|
122
|
+
this.size.navigation = 44; //导航栏高度
|
|
121
123
|
this.size.bodyHeight = system.screenHeight - this.size.top - this.size.navigation; //除去顶部和菜单的高度
|
|
122
124
|
|
|
123
125
|
// #endif
|
|
@@ -164,7 +166,8 @@ export default class {
|
|
|
164
166
|
// console.log('plus.runtime', plus.runtime)
|
|
165
167
|
this.os = plus.os.name.toLowerCase(); //操作系统,android或ios
|
|
166
168
|
this.osver = plus.os.version; //操作系统版本号
|
|
167
|
-
this.version = import.meta.env.VITE_VERSION
|
|
169
|
+
this.version = import.meta.env.VITE_VERSION; //热更包版本号
|
|
170
|
+
this.ua = (import.meta.env.VITE_UA || 'Mozilla/5.0 ({os}/{osver} {brand}/{model})').re(this);
|
|
168
171
|
|
|
169
172
|
this.packName = plus.weex.config.env.appName; //包名
|
|
170
173
|
this.appid = plus.runtime.appid; //如:__UNI__123456
|
|
@@ -180,7 +183,7 @@ export default class {
|
|
|
180
183
|
// console.log('plus.device.getOAID', res)
|
|
181
184
|
this.oaid = res.oaid;
|
|
182
185
|
},
|
|
183
|
-
fail: err => {
|
|
186
|
+
fail: (err) => {
|
|
184
187
|
// console.error('plus.device.getOAID', this.os, err);
|
|
185
188
|
this.simulator++;
|
|
186
189
|
}
|
|
@@ -190,7 +193,7 @@ export default class {
|
|
|
190
193
|
// console.log('plus.device.getAAID', res)
|
|
191
194
|
this.aaid = res.aaid;
|
|
192
195
|
},
|
|
193
|
-
fail: err => {
|
|
196
|
+
fail: (err) => {
|
|
194
197
|
// console.error('plus.device.getAAID', err);
|
|
195
198
|
this.simulator++;
|
|
196
199
|
}
|
|
@@ -212,18 +215,6 @@ export default class {
|
|
|
212
215
|
});
|
|
213
216
|
// #endif
|
|
214
217
|
|
|
215
|
-
|
|
216
|
-
for (let k in conf) {
|
|
217
|
-
if (k === 'ua') {
|
|
218
|
-
//#ifndef H5 || MP
|
|
219
|
-
//h5和小程序不可以自定义
|
|
220
|
-
this.ua = (conf.ua || 'Mozilla/5.0 ({os}/{osver} {brand}/{model})').re(this);
|
|
221
|
-
//#endif
|
|
222
|
-
}
|
|
223
|
-
else {
|
|
224
|
-
this[k] = conf[k];
|
|
225
|
-
}
|
|
226
|
-
}
|
|
227
218
|
}
|
|
228
219
|
catch (e) {
|
|
229
220
|
console.error(e);
|
|
@@ -261,6 +252,7 @@ export default class {
|
|
|
261
252
|
theme: this.theme,
|
|
262
253
|
|
|
263
254
|
//#ifdef APP-PLUS
|
|
255
|
+
os: this.os,
|
|
264
256
|
packName: this.packName,
|
|
265
257
|
simulator: this.simulator, //模拟器可能性判断,oaid,aaid,uuid其中任一个读取出错各加1
|
|
266
258
|
oaid: this.oaid,
|