@dcloudio/uni-app-plus 2.0.0 → 2.0.1-33420211227001
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/dist/automator.view.js +1 -1
- package/dist/index.js +543 -138
- package/dist/index.v3.js +1540 -460
- package/dist/view.css +1 -1
- package/dist/view.umd.js +21028 -11114
- package/dist/view.umd.min.js +2 -2
- package/lib/uni.automator.js +1 -1
- package/package.json +2 -2
- package/template/common/__uniappchooselocation.js +1 -1
- package/template/common/__uniapperror.png +0 -0
- package/template/v3/__uniappquill.js +1 -1
- package/template/v3/__uniappquillimageresize.js +1 -1
package/dist/index.js
CHANGED
|
@@ -1,4 +1,83 @@
|
|
|
1
1
|
import Vue from 'vue';
|
|
2
|
+
import { initVueI18n } from '@dcloudio/uni-i18n';
|
|
3
|
+
|
|
4
|
+
let realAtob;
|
|
5
|
+
|
|
6
|
+
const b64 = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=';
|
|
7
|
+
const b64re = /^(?:[A-Za-z\d+/]{4})*?(?:[A-Za-z\d+/]{2}(?:==)?|[A-Za-z\d+/]{3}=?)?$/;
|
|
8
|
+
|
|
9
|
+
if (typeof atob !== 'function') {
|
|
10
|
+
realAtob = function (str) {
|
|
11
|
+
str = String(str).replace(/[\t\n\f\r ]+/g, '');
|
|
12
|
+
if (!b64re.test(str)) { throw new Error("Failed to execute 'atob' on 'Window': The string to be decoded is not correctly encoded.") }
|
|
13
|
+
|
|
14
|
+
// Adding the padding if missing, for semplicity
|
|
15
|
+
str += '=='.slice(2 - (str.length & 3));
|
|
16
|
+
var bitmap; var result = ''; var r1; var r2; var i = 0;
|
|
17
|
+
for (; i < str.length;) {
|
|
18
|
+
bitmap = b64.indexOf(str.charAt(i++)) << 18 | b64.indexOf(str.charAt(i++)) << 12 |
|
|
19
|
+
(r1 = b64.indexOf(str.charAt(i++))) << 6 | (r2 = b64.indexOf(str.charAt(i++)));
|
|
20
|
+
|
|
21
|
+
result += r1 === 64 ? String.fromCharCode(bitmap >> 16 & 255)
|
|
22
|
+
: r2 === 64 ? String.fromCharCode(bitmap >> 16 & 255, bitmap >> 8 & 255)
|
|
23
|
+
: String.fromCharCode(bitmap >> 16 & 255, bitmap >> 8 & 255, bitmap & 255);
|
|
24
|
+
}
|
|
25
|
+
return result
|
|
26
|
+
};
|
|
27
|
+
} else {
|
|
28
|
+
// 注意atob只能在全局对象上调用,例如:`const Base64 = {atob};Base64.atob('xxxx')`是错误的用法
|
|
29
|
+
realAtob = atob;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
function b64DecodeUnicode (str) {
|
|
33
|
+
return decodeURIComponent(realAtob(str).split('').map(function (c) {
|
|
34
|
+
return '%' + ('00' + c.charCodeAt(0).toString(16)).slice(-2)
|
|
35
|
+
}).join(''))
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
function getCurrentUserInfo () {
|
|
39
|
+
const token = ( uni ).getStorageSync('uni_id_token') || '';
|
|
40
|
+
const tokenArr = token.split('.');
|
|
41
|
+
if (!token || tokenArr.length !== 3) {
|
|
42
|
+
return {
|
|
43
|
+
uid: null,
|
|
44
|
+
role: [],
|
|
45
|
+
permission: [],
|
|
46
|
+
tokenExpired: 0
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
let userInfo;
|
|
50
|
+
try {
|
|
51
|
+
userInfo = JSON.parse(b64DecodeUnicode(tokenArr[1]));
|
|
52
|
+
} catch (error) {
|
|
53
|
+
throw new Error('获取当前用户信息出错,详细错误信息为:' + error.message)
|
|
54
|
+
}
|
|
55
|
+
userInfo.tokenExpired = userInfo.exp * 1000;
|
|
56
|
+
delete userInfo.exp;
|
|
57
|
+
delete userInfo.iat;
|
|
58
|
+
return userInfo
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
function uniIdMixin (Vue) {
|
|
62
|
+
Vue.prototype.uniIDHasRole = function (roleId) {
|
|
63
|
+
const {
|
|
64
|
+
role
|
|
65
|
+
} = getCurrentUserInfo();
|
|
66
|
+
return role.indexOf(roleId) > -1
|
|
67
|
+
};
|
|
68
|
+
Vue.prototype.uniIDHasPermission = function (permissionId) {
|
|
69
|
+
const {
|
|
70
|
+
permission
|
|
71
|
+
} = getCurrentUserInfo();
|
|
72
|
+
return this.uniIDHasRole('admin') || permission.indexOf(permissionId) > -1
|
|
73
|
+
};
|
|
74
|
+
Vue.prototype.uniIDTokenValid = function () {
|
|
75
|
+
const {
|
|
76
|
+
tokenExpired
|
|
77
|
+
} = getCurrentUserInfo();
|
|
78
|
+
return tokenExpired > Date.now()
|
|
79
|
+
};
|
|
80
|
+
}
|
|
2
81
|
|
|
3
82
|
const _toString = Object.prototype.toString;
|
|
4
83
|
const hasOwnProperty = Object.prototype.hasOwnProperty;
|
|
@@ -142,7 +221,7 @@ function queue (hooks, data) {
|
|
|
142
221
|
}
|
|
143
222
|
if (res === false) {
|
|
144
223
|
return {
|
|
145
|
-
then () {}
|
|
224
|
+
then () { }
|
|
146
225
|
}
|
|
147
226
|
}
|
|
148
227
|
}
|
|
@@ -190,15 +269,15 @@ function getApiInterceptorHooks (method) {
|
|
|
190
269
|
if (hook !== 'returnValue') {
|
|
191
270
|
interceptor[hook] = globalInterceptors[hook].slice();
|
|
192
271
|
}
|
|
193
|
-
});
|
|
194
|
-
const scopedInterceptor = scopedInterceptors[method];
|
|
195
|
-
if (scopedInterceptor) {
|
|
196
|
-
Object.keys(scopedInterceptor).forEach(hook => {
|
|
197
|
-
if (hook !== 'returnValue') {
|
|
198
|
-
interceptor[hook] = (interceptor[hook] || []).concat(scopedInterceptor[hook]);
|
|
199
|
-
}
|
|
200
|
-
});
|
|
201
|
-
}
|
|
272
|
+
});
|
|
273
|
+
const scopedInterceptor = scopedInterceptors[method];
|
|
274
|
+
if (scopedInterceptor) {
|
|
275
|
+
Object.keys(scopedInterceptor).forEach(hook => {
|
|
276
|
+
if (hook !== 'returnValue') {
|
|
277
|
+
interceptor[hook] = (interceptor[hook] || []).concat(scopedInterceptor[hook]);
|
|
278
|
+
}
|
|
279
|
+
});
|
|
280
|
+
}
|
|
202
281
|
return interceptor
|
|
203
282
|
}
|
|
204
283
|
|
|
@@ -222,16 +301,20 @@ const promiseInterceptor = {
|
|
|
222
301
|
if (!isPromise(res)) {
|
|
223
302
|
return res
|
|
224
303
|
}
|
|
225
|
-
return
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
304
|
+
return new Promise((resolve, reject) => {
|
|
305
|
+
res.then(res => {
|
|
306
|
+
if (res[0]) {
|
|
307
|
+
reject(res[0]);
|
|
308
|
+
} else {
|
|
309
|
+
resolve(res[1]);
|
|
310
|
+
}
|
|
311
|
+
});
|
|
229
312
|
})
|
|
230
313
|
}
|
|
231
314
|
};
|
|
232
315
|
|
|
233
316
|
const SYNC_API_RE =
|
|
234
|
-
/^\$|Window$|WindowStyle$|sendNativeEvent|restoreGlobal|getCurrentSubNVue|getMenuButtonBoundingClientRect|^report|interceptors|Interceptor$|getSubNVueById|requireNativePlugin|upx2px|hideKeyboard|canIUse|^create|Sync$|Manager$|base64ToArrayBuffer|arrayBufferToBase64/;
|
|
317
|
+
/^\$|Window$|WindowStyle$|sendHostEvent|sendNativeEvent|restoreGlobal|getCurrentSubNVue|getMenuButtonBoundingClientRect|^report|interceptors|Interceptor$|getSubNVueById|requireNativePlugin|upx2px|hideKeyboard|canIUse|^create|Sync$|Manager$|base64ToArrayBuffer|arrayBufferToBase64|getLocale|setLocale/;
|
|
235
318
|
|
|
236
319
|
const CONTEXT_API_RE = /^create|Manager$/;
|
|
237
320
|
|
|
@@ -344,6 +427,44 @@ function upx2px (number, newDeviceWidth) {
|
|
|
344
427
|
return number < 0 ? -result : result
|
|
345
428
|
}
|
|
346
429
|
|
|
430
|
+
function getLocale () {
|
|
431
|
+
// 优先使用 $locale
|
|
432
|
+
const app = getApp({
|
|
433
|
+
allowDefault: true
|
|
434
|
+
});
|
|
435
|
+
if (app && app.$vm) {
|
|
436
|
+
return app.$vm.$locale
|
|
437
|
+
}
|
|
438
|
+
return wx.getSystemInfoSync().language || 'zh-Hans'
|
|
439
|
+
}
|
|
440
|
+
|
|
441
|
+
function setLocale (locale) {
|
|
442
|
+
const app = getApp();
|
|
443
|
+
if (!app) {
|
|
444
|
+
return false
|
|
445
|
+
}
|
|
446
|
+
const oldLocale = app.$vm.$locale;
|
|
447
|
+
if (oldLocale !== locale) {
|
|
448
|
+
app.$vm.$locale = locale;
|
|
449
|
+
onLocaleChangeCallbacks.forEach((fn) => fn({
|
|
450
|
+
locale
|
|
451
|
+
}));
|
|
452
|
+
return true
|
|
453
|
+
}
|
|
454
|
+
return false
|
|
455
|
+
}
|
|
456
|
+
|
|
457
|
+
const onLocaleChangeCallbacks = [];
|
|
458
|
+
function onLocaleChange (fn) {
|
|
459
|
+
if (onLocaleChangeCallbacks.indexOf(fn) === -1) {
|
|
460
|
+
onLocaleChangeCallbacks.push(fn);
|
|
461
|
+
}
|
|
462
|
+
}
|
|
463
|
+
|
|
464
|
+
if (typeof global !== 'undefined') {
|
|
465
|
+
global.getLocale = getLocale;
|
|
466
|
+
}
|
|
467
|
+
|
|
347
468
|
const interceptors = {
|
|
348
469
|
promiseInterceptor
|
|
349
470
|
};
|
|
@@ -351,6 +472,9 @@ const interceptors = {
|
|
|
351
472
|
var baseApi = /*#__PURE__*/Object.freeze({
|
|
352
473
|
__proto__: null,
|
|
353
474
|
upx2px: upx2px,
|
|
475
|
+
getLocale: getLocale,
|
|
476
|
+
setLocale: setLocale,
|
|
477
|
+
onLocaleChange: onLocaleChange,
|
|
354
478
|
addInterceptor: addInterceptor,
|
|
355
479
|
removeInterceptor: removeInterceptor,
|
|
356
480
|
interceptors: interceptors
|
|
@@ -601,18 +725,13 @@ const customize = cached((str) => {
|
|
|
601
725
|
});
|
|
602
726
|
|
|
603
727
|
function initTriggerEvent (mpInstance) {
|
|
604
|
-
{
|
|
605
|
-
if (!wx.canIUse || !wx.canIUse('nextTick')) {
|
|
606
|
-
return
|
|
607
|
-
}
|
|
608
|
-
}
|
|
609
728
|
const oldTriggerEvent = mpInstance.triggerEvent;
|
|
610
729
|
mpInstance.triggerEvent = function (event, ...args) {
|
|
611
730
|
return oldTriggerEvent.apply(mpInstance, [customize(event), ...args])
|
|
612
731
|
};
|
|
613
732
|
}
|
|
614
733
|
|
|
615
|
-
function initHook (name, options) {
|
|
734
|
+
function initHook (name, options, isComponent) {
|
|
616
735
|
const oldHook = options[name];
|
|
617
736
|
if (!oldHook) {
|
|
618
737
|
options[name] = function () {
|
|
@@ -850,6 +969,11 @@ function initProperties (props, isBehavior = false, file = '') {
|
|
|
850
969
|
type: Object,
|
|
851
970
|
value: null
|
|
852
971
|
};
|
|
972
|
+
// scopedSlotsCompiler auto
|
|
973
|
+
properties.scopedSlotsCompiler = {
|
|
974
|
+
type: String,
|
|
975
|
+
value: ''
|
|
976
|
+
};
|
|
853
977
|
properties.vueSlots = { // 小程序不能直接定义 $slots 的 props,所以通过 vueSlots 转换到 $slots
|
|
854
978
|
type: null,
|
|
855
979
|
value: [],
|
|
@@ -1177,6 +1301,283 @@ function handleEvent (event) {
|
|
|
1177
1301
|
}
|
|
1178
1302
|
}
|
|
1179
1303
|
|
|
1304
|
+
var en = {
|
|
1305
|
+
"uni.app.quit": "Press back button again to exit",
|
|
1306
|
+
"uni.async.error": "The connection timed out, click the screen to try again.",
|
|
1307
|
+
"uni.showActionSheet.cancel": "Cancel",
|
|
1308
|
+
"uni.showToast.unpaired": "Please note showToast must be paired with hideToast",
|
|
1309
|
+
"uni.showLoading.unpaired": "Please note showLoading must be paired with hideLoading",
|
|
1310
|
+
"uni.showModal.cancel": "Cancel",
|
|
1311
|
+
"uni.showModal.confirm": "OK",
|
|
1312
|
+
"uni.chooseImage.cancel": "Cancel",
|
|
1313
|
+
"uni.chooseImage.sourceType.album": "Album",
|
|
1314
|
+
"uni.chooseImage.sourceType.camera": "Camera",
|
|
1315
|
+
"uni.chooseVideo.cancel": "Cancel",
|
|
1316
|
+
"uni.chooseVideo.sourceType.album": "Album",
|
|
1317
|
+
"uni.chooseVideo.sourceType.camera": "Camera",
|
|
1318
|
+
"uni.chooseFile.notUserActivation": "File chooser dialog can only be shown with a user activation",
|
|
1319
|
+
"uni.previewImage.cancel": "Cancel",
|
|
1320
|
+
"uni.previewImage.button.save": "Save Image",
|
|
1321
|
+
"uni.previewImage.save.success": "Saved successfully",
|
|
1322
|
+
"uni.previewImage.save.fail": "Save failed",
|
|
1323
|
+
"uni.setClipboardData.success": "Content copied",
|
|
1324
|
+
"uni.scanCode.title": "Scan code",
|
|
1325
|
+
"uni.scanCode.album": "Album",
|
|
1326
|
+
"uni.scanCode.fail": "Recognition failure",
|
|
1327
|
+
"uni.scanCode.flash.on": "Tap to turn light on",
|
|
1328
|
+
"uni.scanCode.flash.off": "Tap to turn light off",
|
|
1329
|
+
"uni.startSoterAuthentication.authContent": "Fingerprint recognition",
|
|
1330
|
+
"uni.picker.done": "Done",
|
|
1331
|
+
"uni.picker.cancel": "Cancel",
|
|
1332
|
+
"uni.video.danmu": "Danmu",
|
|
1333
|
+
"uni.video.volume": "Volume",
|
|
1334
|
+
"uni.button.feedback.title": "feedback",
|
|
1335
|
+
"uni.button.feedback.send": "send",
|
|
1336
|
+
"uni.chooseLocation.search": "Find Place",
|
|
1337
|
+
"uni.chooseLocation.cancel": "Cancel"
|
|
1338
|
+
};
|
|
1339
|
+
|
|
1340
|
+
var es = {
|
|
1341
|
+
"uni.app.quit": "Pulse otra vez para salir",
|
|
1342
|
+
"uni.async.error": "Se agotó el tiempo de conexión, haga clic en la pantalla para volver a intentarlo.",
|
|
1343
|
+
"uni.showActionSheet.cancel": "Cancelar",
|
|
1344
|
+
"uni.showToast.unpaired": "Tenga en cuenta que showToast debe estar emparejado con hideToast",
|
|
1345
|
+
"uni.showLoading.unpaired": "Tenga en cuenta que showLoading debe estar emparejado con hideLoading",
|
|
1346
|
+
"uni.showModal.cancel": "Cancelar",
|
|
1347
|
+
"uni.showModal.confirm": "OK",
|
|
1348
|
+
"uni.chooseImage.cancel": "Cancelar",
|
|
1349
|
+
"uni.chooseImage.sourceType.album": "Álbum",
|
|
1350
|
+
"uni.chooseImage.sourceType.camera": "Cámara",
|
|
1351
|
+
"uni.chooseVideo.cancel": "Cancelar",
|
|
1352
|
+
"uni.chooseVideo.sourceType.album": "Álbum",
|
|
1353
|
+
"uni.chooseVideo.sourceType.camera": "Cámara",
|
|
1354
|
+
"uni.chooseFile.notUserActivation": "El cuadro de diálogo del selector de archivos solo se puede mostrar con la activación del usuario",
|
|
1355
|
+
"uni.previewImage.cancel": "Cancelar",
|
|
1356
|
+
"uni.previewImage.button.save": "Guardar imagen",
|
|
1357
|
+
"uni.previewImage.save.success": "Guardado exitosamente",
|
|
1358
|
+
"uni.previewImage.save.fail": "Error al guardar",
|
|
1359
|
+
"uni.setClipboardData.success": "Contenido copiado",
|
|
1360
|
+
"uni.scanCode.title": "Código de escaneo",
|
|
1361
|
+
"uni.scanCode.album": "Álbum",
|
|
1362
|
+
"uni.scanCode.fail": "Échec de la reconnaissance",
|
|
1363
|
+
"uni.scanCode.flash.on": "Toque para encender la luz",
|
|
1364
|
+
"uni.scanCode.flash.off": "Toque para apagar la luz",
|
|
1365
|
+
"uni.startSoterAuthentication.authContent": "Reconocimiento de huellas dactilares",
|
|
1366
|
+
"uni.picker.done": "OK",
|
|
1367
|
+
"uni.picker.cancel": "Cancelar",
|
|
1368
|
+
"uni.video.danmu": "Danmu",
|
|
1369
|
+
"uni.video.volume": "Volumen",
|
|
1370
|
+
"uni.button.feedback.title": "realimentación",
|
|
1371
|
+
"uni.button.feedback.send": "enviar",
|
|
1372
|
+
"uni.chooseLocation.search": "Encontrar",
|
|
1373
|
+
"uni.chooseLocation.cancel": "Cancelar"
|
|
1374
|
+
};
|
|
1375
|
+
|
|
1376
|
+
var fr = {
|
|
1377
|
+
"uni.app.quit": "Appuyez à nouveau pour quitter l'application",
|
|
1378
|
+
"uni.async.error": "La connexion a expiré, cliquez sur l'écran pour réessayer.",
|
|
1379
|
+
"uni.showActionSheet.cancel": "Annuler",
|
|
1380
|
+
"uni.showToast.unpaired": "Veuillez noter que showToast doit être associé à hideToast",
|
|
1381
|
+
"uni.showLoading.unpaired": "Veuillez noter que showLoading doit être associé à hideLoading",
|
|
1382
|
+
"uni.showModal.cancel": "Annuler",
|
|
1383
|
+
"uni.showModal.confirm": "OK",
|
|
1384
|
+
"uni.chooseImage.cancel": "Annuler",
|
|
1385
|
+
"uni.chooseImage.sourceType.album": "Album",
|
|
1386
|
+
"uni.chooseImage.sourceType.camera": "Caméra",
|
|
1387
|
+
"uni.chooseVideo.cancel": "Annuler",
|
|
1388
|
+
"uni.chooseVideo.sourceType.album": "Album",
|
|
1389
|
+
"uni.chooseVideo.sourceType.camera": "Caméra",
|
|
1390
|
+
"uni.chooseFile.notUserActivation": "La boîte de dialogue du sélecteur de fichier ne peut être affichée qu'avec une activation par l'utilisateur",
|
|
1391
|
+
"uni.previewImage.cancel": "Annuler",
|
|
1392
|
+
"uni.previewImage.button.save": "Guardar imagen",
|
|
1393
|
+
"uni.previewImage.save.success": "Enregistré avec succès",
|
|
1394
|
+
"uni.previewImage.save.fail": "Échec de la sauvegarde",
|
|
1395
|
+
"uni.setClipboardData.success": "Contenu copié",
|
|
1396
|
+
"uni.scanCode.title": "Code d’analyse",
|
|
1397
|
+
"uni.scanCode.album": "Album",
|
|
1398
|
+
"uni.scanCode.fail": "Fallo de reconocimiento",
|
|
1399
|
+
"uni.scanCode.flash.on": "Appuyez pour activer l'éclairage",
|
|
1400
|
+
"uni.scanCode.flash.off": "Appuyez pour désactiver l'éclairage",
|
|
1401
|
+
"uni.startSoterAuthentication.authContent": "Reconnaissance de l'empreinte digitale",
|
|
1402
|
+
"uni.picker.done": "OK",
|
|
1403
|
+
"uni.picker.cancel": "Annuler",
|
|
1404
|
+
"uni.video.danmu": "Danmu",
|
|
1405
|
+
"uni.video.volume": "Le Volume",
|
|
1406
|
+
"uni.button.feedback.title": "retour d'information",
|
|
1407
|
+
"uni.button.feedback.send": "envoyer",
|
|
1408
|
+
"uni.chooseLocation.search": "Trouve",
|
|
1409
|
+
"uni.chooseLocation.cancel": "Annuler"
|
|
1410
|
+
};
|
|
1411
|
+
|
|
1412
|
+
var zhHans = {
|
|
1413
|
+
"uni.app.quit": "再按一次退出应用",
|
|
1414
|
+
"uni.async.error": "连接服务器超时,点击屏幕重试",
|
|
1415
|
+
"uni.showActionSheet.cancel": "取消",
|
|
1416
|
+
"uni.showToast.unpaired": "请注意 showToast 与 hideToast 必须配对使用",
|
|
1417
|
+
"uni.showLoading.unpaired": "请注意 showLoading 与 hideLoading 必须配对使用",
|
|
1418
|
+
"uni.showModal.cancel": "取消",
|
|
1419
|
+
"uni.showModal.confirm": "确定",
|
|
1420
|
+
"uni.chooseImage.cancel": "取消",
|
|
1421
|
+
"uni.chooseImage.sourceType.album": "从相册选择",
|
|
1422
|
+
"uni.chooseImage.sourceType.camera": "拍摄",
|
|
1423
|
+
"uni.chooseVideo.cancel": "取消",
|
|
1424
|
+
"uni.chooseVideo.sourceType.album": "从相册选择",
|
|
1425
|
+
"uni.chooseVideo.sourceType.camera": "拍摄",
|
|
1426
|
+
"uni.chooseFile.notUserActivation": "文件选择器对话框只能在由用户激活时显示",
|
|
1427
|
+
"uni.previewImage.cancel": "取消",
|
|
1428
|
+
"uni.previewImage.button.save": "保存图像",
|
|
1429
|
+
"uni.previewImage.save.success": "保存图像到相册成功",
|
|
1430
|
+
"uni.previewImage.save.fail": "保存图像到相册失败",
|
|
1431
|
+
"uni.setClipboardData.success": "内容已复制",
|
|
1432
|
+
"uni.scanCode.title": "扫码",
|
|
1433
|
+
"uni.scanCode.album": "相册",
|
|
1434
|
+
"uni.scanCode.fail": "识别失败",
|
|
1435
|
+
"uni.scanCode.flash.on": "轻触照亮",
|
|
1436
|
+
"uni.scanCode.flash.off": "轻触关闭",
|
|
1437
|
+
"uni.startSoterAuthentication.authContent": "指纹识别中...",
|
|
1438
|
+
"uni.picker.done": "完成",
|
|
1439
|
+
"uni.picker.cancel": "取消",
|
|
1440
|
+
"uni.video.danmu": "弹幕",
|
|
1441
|
+
"uni.video.volume": "音量",
|
|
1442
|
+
"uni.button.feedback.title": "问题反馈",
|
|
1443
|
+
"uni.button.feedback.send": "发送",
|
|
1444
|
+
"uni.chooseLocation.search": "搜索地点",
|
|
1445
|
+
"uni.chooseLocation.cancel": "取消"
|
|
1446
|
+
};
|
|
1447
|
+
|
|
1448
|
+
var zhHant = {
|
|
1449
|
+
"uni.app.quit": "再按一次退出應用",
|
|
1450
|
+
"uni.async.error": "連接服務器超時,點擊屏幕重試",
|
|
1451
|
+
"uni.showActionSheet.cancel": "取消",
|
|
1452
|
+
"uni.showToast.unpaired": "請注意 showToast 與 hideToast 必須配對使用",
|
|
1453
|
+
"uni.showLoading.unpaired": "請注意 showLoading 與 hideLoading 必須配對使用",
|
|
1454
|
+
"uni.showModal.cancel": "取消",
|
|
1455
|
+
"uni.showModal.confirm": "確定",
|
|
1456
|
+
"uni.chooseImage.cancel": "取消",
|
|
1457
|
+
"uni.chooseImage.sourceType.album": "從相冊選擇",
|
|
1458
|
+
"uni.chooseImage.sourceType.camera": "拍攝",
|
|
1459
|
+
"uni.chooseVideo.cancel": "取消",
|
|
1460
|
+
"uni.chooseVideo.sourceType.album": "從相冊選擇",
|
|
1461
|
+
"uni.chooseVideo.sourceType.camera": "拍攝",
|
|
1462
|
+
"uni.chooseFile.notUserActivation": "文件選擇器對話框只能在由用戶激活時顯示",
|
|
1463
|
+
"uni.previewImage.cancel": "取消",
|
|
1464
|
+
"uni.previewImage.button.save": "保存圖像",
|
|
1465
|
+
"uni.previewImage.save.success": "保存圖像到相冊成功",
|
|
1466
|
+
"uni.previewImage.save.fail": "保存圖像到相冊失敗",
|
|
1467
|
+
"uni.setClipboardData.success": "內容已復制",
|
|
1468
|
+
"uni.scanCode.title": "掃碼",
|
|
1469
|
+
"uni.scanCode.album": "相冊",
|
|
1470
|
+
"uni.scanCode.fail": "識別失敗",
|
|
1471
|
+
"uni.scanCode.flash.on": "輕觸照亮",
|
|
1472
|
+
"uni.scanCode.flash.off": "輕觸關閉",
|
|
1473
|
+
"uni.startSoterAuthentication.authContent": "指紋識別中...",
|
|
1474
|
+
"uni.picker.done": "完成",
|
|
1475
|
+
"uni.picker.cancel": "取消",
|
|
1476
|
+
"uni.video.danmu": "彈幕",
|
|
1477
|
+
"uni.video.volume": "音量",
|
|
1478
|
+
"uni.button.feedback.title": "問題反饋",
|
|
1479
|
+
"uni.button.feedback.send": "發送",
|
|
1480
|
+
"uni.chooseLocation.search": "搜索地點",
|
|
1481
|
+
"uni.chooseLocation.cancel": "取消"
|
|
1482
|
+
};
|
|
1483
|
+
|
|
1484
|
+
const messages = {};
|
|
1485
|
+
|
|
1486
|
+
{
|
|
1487
|
+
Object.assign(messages, {
|
|
1488
|
+
en,
|
|
1489
|
+
es,
|
|
1490
|
+
fr,
|
|
1491
|
+
'zh-Hans': zhHans,
|
|
1492
|
+
'zh-Hant': zhHant
|
|
1493
|
+
});
|
|
1494
|
+
}
|
|
1495
|
+
|
|
1496
|
+
let locale;
|
|
1497
|
+
|
|
1498
|
+
{
|
|
1499
|
+
if (typeof weex === 'object') {
|
|
1500
|
+
locale = weex.requireModule('plus').getLanguage();
|
|
1501
|
+
} else {
|
|
1502
|
+
locale = '';
|
|
1503
|
+
}
|
|
1504
|
+
}
|
|
1505
|
+
|
|
1506
|
+
function initI18nMessages () {
|
|
1507
|
+
if (!isEnableLocale()) {
|
|
1508
|
+
return
|
|
1509
|
+
}
|
|
1510
|
+
const localeKeys = Object.keys(__uniConfig.locales);
|
|
1511
|
+
if (localeKeys.length) {
|
|
1512
|
+
localeKeys.forEach((locale) => {
|
|
1513
|
+
const curMessages = messages[locale];
|
|
1514
|
+
const userMessages = __uniConfig.locales[locale];
|
|
1515
|
+
if (curMessages) {
|
|
1516
|
+
Object.assign(curMessages, userMessages);
|
|
1517
|
+
} else {
|
|
1518
|
+
messages[locale] = userMessages;
|
|
1519
|
+
}
|
|
1520
|
+
});
|
|
1521
|
+
}
|
|
1522
|
+
}
|
|
1523
|
+
|
|
1524
|
+
initI18nMessages();
|
|
1525
|
+
|
|
1526
|
+
const i18n = initVueI18n(
|
|
1527
|
+
locale,
|
|
1528
|
+
messages
|
|
1529
|
+
);
|
|
1530
|
+
const t = i18n.t;
|
|
1531
|
+
const i18nMixin = (i18n.mixin = {
|
|
1532
|
+
beforeCreate () {
|
|
1533
|
+
const unwatch = i18n.i18n.watchLocale(() => {
|
|
1534
|
+
this.$forceUpdate();
|
|
1535
|
+
});
|
|
1536
|
+
this.$once('hook:beforeDestroy', function () {
|
|
1537
|
+
unwatch();
|
|
1538
|
+
});
|
|
1539
|
+
},
|
|
1540
|
+
methods: {
|
|
1541
|
+
$$t (key, values) {
|
|
1542
|
+
return t(key, values)
|
|
1543
|
+
}
|
|
1544
|
+
}
|
|
1545
|
+
});
|
|
1546
|
+
const setLocale$1 = i18n.setLocale;
|
|
1547
|
+
const getLocale$1 = i18n.getLocale;
|
|
1548
|
+
|
|
1549
|
+
function initAppLocale (Vue, appVm, locale) {
|
|
1550
|
+
const state = Vue.observable({
|
|
1551
|
+
locale: locale || i18n.getLocale()
|
|
1552
|
+
});
|
|
1553
|
+
const localeWatchers = [];
|
|
1554
|
+
appVm.$watchLocale = fn => {
|
|
1555
|
+
localeWatchers.push(fn);
|
|
1556
|
+
};
|
|
1557
|
+
Object.defineProperty(appVm, '$locale', {
|
|
1558
|
+
get () {
|
|
1559
|
+
return state.locale
|
|
1560
|
+
},
|
|
1561
|
+
set (v) {
|
|
1562
|
+
state.locale = v;
|
|
1563
|
+
localeWatchers.forEach(watch => watch(v));
|
|
1564
|
+
}
|
|
1565
|
+
});
|
|
1566
|
+
}
|
|
1567
|
+
|
|
1568
|
+
function isEnableLocale () {
|
|
1569
|
+
return typeof __uniConfig !== 'undefined' && __uniConfig.locales && !!Object.keys(__uniConfig.locales).length
|
|
1570
|
+
}
|
|
1571
|
+
|
|
1572
|
+
// export function initI18n() {
|
|
1573
|
+
// const localeKeys = Object.keys(__uniConfig.locales || {})
|
|
1574
|
+
// if (localeKeys.length) {
|
|
1575
|
+
// localeKeys.forEach((locale) =>
|
|
1576
|
+
// i18n.add(locale, __uniConfig.locales[locale])
|
|
1577
|
+
// )
|
|
1578
|
+
// }
|
|
1579
|
+
// }
|
|
1580
|
+
|
|
1180
1581
|
class EventChannel {
|
|
1181
1582
|
constructor (id, events) {
|
|
1182
1583
|
this.id = id;
|
|
@@ -1258,109 +1659,112 @@ function getEventChannel (id) {
|
|
|
1258
1659
|
return eventChannelStack.shift()
|
|
1259
1660
|
}
|
|
1260
1661
|
|
|
1261
|
-
const hooks = [
|
|
1262
|
-
'onShow',
|
|
1263
|
-
'onHide',
|
|
1264
|
-
'onError',
|
|
1265
|
-
'onPageNotFound',
|
|
1266
|
-
'onThemeChange',
|
|
1267
|
-
'onUnhandledRejection'
|
|
1268
|
-
];
|
|
1269
|
-
|
|
1270
|
-
function initEventChannel () {
|
|
1271
|
-
Vue.prototype.getOpenerEventChannel = function () {
|
|
1272
|
-
if (!this.__eventChannel__) {
|
|
1273
|
-
this.__eventChannel__ = new EventChannel();
|
|
1274
|
-
}
|
|
1275
|
-
return this.__eventChannel__
|
|
1276
|
-
};
|
|
1277
|
-
const callHook = Vue.prototype.__call_hook;
|
|
1278
|
-
Vue.prototype.__call_hook = function (hook, args) {
|
|
1279
|
-
if (hook === 'onLoad' && args && args.__id__) {
|
|
1280
|
-
this.__eventChannel__ = getEventChannel(args.__id__);
|
|
1281
|
-
delete args.__id__;
|
|
1282
|
-
}
|
|
1283
|
-
return callHook.call(this, hook, args)
|
|
1284
|
-
};
|
|
1285
|
-
}
|
|
1286
|
-
|
|
1287
|
-
function parseBaseApp (vm, {
|
|
1288
|
-
mocks,
|
|
1289
|
-
initRefs
|
|
1290
|
-
}) {
|
|
1291
|
-
initEventChannel();
|
|
1292
|
-
if (vm.$options.store) {
|
|
1293
|
-
Vue.prototype.$store = vm.$options.store;
|
|
1294
|
-
}
|
|
1295
|
-
|
|
1296
|
-
|
|
1297
|
-
|
|
1298
|
-
|
|
1299
|
-
|
|
1300
|
-
|
|
1301
|
-
|
|
1302
|
-
|
|
1303
|
-
|
|
1304
|
-
|
|
1305
|
-
|
|
1306
|
-
|
|
1307
|
-
|
|
1308
|
-
|
|
1309
|
-
|
|
1310
|
-
|
|
1311
|
-
|
|
1312
|
-
|
|
1313
|
-
|
|
1314
|
-
delete this.$options.
|
|
1315
|
-
|
|
1316
|
-
|
|
1317
|
-
|
|
1318
|
-
|
|
1319
|
-
|
|
1320
|
-
|
|
1321
|
-
|
|
1322
|
-
|
|
1323
|
-
|
|
1324
|
-
|
|
1325
|
-
|
|
1326
|
-
|
|
1327
|
-
|
|
1328
|
-
|
|
1329
|
-
|
|
1330
|
-
|
|
1331
|
-
|
|
1332
|
-
|
|
1333
|
-
|
|
1334
|
-
|
|
1335
|
-
|
|
1336
|
-
|
|
1337
|
-
|
|
1338
|
-
|
|
1339
|
-
|
|
1340
|
-
|
|
1341
|
-
|
|
1342
|
-
|
|
1343
|
-
|
|
1344
|
-
|
|
1345
|
-
this.$vm.
|
|
1346
|
-
|
|
1347
|
-
|
|
1348
|
-
|
|
1349
|
-
|
|
1350
|
-
|
|
1351
|
-
|
|
1352
|
-
|
|
1353
|
-
|
|
1354
|
-
|
|
1355
|
-
|
|
1356
|
-
|
|
1357
|
-
|
|
1358
|
-
|
|
1359
|
-
|
|
1360
|
-
|
|
1361
|
-
|
|
1362
|
-
|
|
1363
|
-
|
|
1662
|
+
const hooks = [
|
|
1663
|
+
'onShow',
|
|
1664
|
+
'onHide',
|
|
1665
|
+
'onError',
|
|
1666
|
+
'onPageNotFound',
|
|
1667
|
+
'onThemeChange',
|
|
1668
|
+
'onUnhandledRejection'
|
|
1669
|
+
];
|
|
1670
|
+
|
|
1671
|
+
function initEventChannel () {
|
|
1672
|
+
Vue.prototype.getOpenerEventChannel = function () {
|
|
1673
|
+
if (!this.__eventChannel__) {
|
|
1674
|
+
this.__eventChannel__ = new EventChannel();
|
|
1675
|
+
}
|
|
1676
|
+
return this.__eventChannel__
|
|
1677
|
+
};
|
|
1678
|
+
const callHook = Vue.prototype.__call_hook;
|
|
1679
|
+
Vue.prototype.__call_hook = function (hook, args) {
|
|
1680
|
+
if (hook === 'onLoad' && args && args.__id__) {
|
|
1681
|
+
this.__eventChannel__ = getEventChannel(args.__id__);
|
|
1682
|
+
delete args.__id__;
|
|
1683
|
+
}
|
|
1684
|
+
return callHook.call(this, hook, args)
|
|
1685
|
+
};
|
|
1686
|
+
}
|
|
1687
|
+
|
|
1688
|
+
function parseBaseApp (vm, {
|
|
1689
|
+
mocks,
|
|
1690
|
+
initRefs
|
|
1691
|
+
}) {
|
|
1692
|
+
initEventChannel();
|
|
1693
|
+
if (vm.$options.store) {
|
|
1694
|
+
Vue.prototype.$store = vm.$options.store;
|
|
1695
|
+
}
|
|
1696
|
+
uniIdMixin(Vue);
|
|
1697
|
+
|
|
1698
|
+
Vue.prototype.mpHost = "app-plus";
|
|
1699
|
+
|
|
1700
|
+
Vue.mixin({
|
|
1701
|
+
beforeCreate () {
|
|
1702
|
+
if (!this.$options.mpType) {
|
|
1703
|
+
return
|
|
1704
|
+
}
|
|
1705
|
+
|
|
1706
|
+
this.mpType = this.$options.mpType;
|
|
1707
|
+
|
|
1708
|
+
this.$mp = {
|
|
1709
|
+
data: {},
|
|
1710
|
+
[this.mpType]: this.$options.mpInstance
|
|
1711
|
+
};
|
|
1712
|
+
|
|
1713
|
+
this.$scope = this.$options.mpInstance;
|
|
1714
|
+
|
|
1715
|
+
delete this.$options.mpType;
|
|
1716
|
+
delete this.$options.mpInstance;
|
|
1717
|
+
if (this.mpType === 'page' && typeof getApp === 'function') { // hack vue-i18n
|
|
1718
|
+
const app = getApp();
|
|
1719
|
+
if (app.$vm && app.$vm.$i18n) {
|
|
1720
|
+
this._i18n = app.$vm.$i18n;
|
|
1721
|
+
}
|
|
1722
|
+
}
|
|
1723
|
+
if (this.mpType !== 'app') {
|
|
1724
|
+
initRefs(this);
|
|
1725
|
+
initMocks(this, mocks);
|
|
1726
|
+
}
|
|
1727
|
+
}
|
|
1728
|
+
});
|
|
1729
|
+
|
|
1730
|
+
const appOptions = {
|
|
1731
|
+
onLaunch (args) {
|
|
1732
|
+
if (this.$vm) { // 已经初始化过了,主要是为了百度,百度 onShow 在 onLaunch 之前
|
|
1733
|
+
return
|
|
1734
|
+
}
|
|
1735
|
+
|
|
1736
|
+
this.$vm = vm;
|
|
1737
|
+
|
|
1738
|
+
this.$vm.$mp = {
|
|
1739
|
+
app: this
|
|
1740
|
+
};
|
|
1741
|
+
|
|
1742
|
+
this.$vm.$scope = this;
|
|
1743
|
+
// vm 上也挂载 globalData
|
|
1744
|
+
this.$vm.globalData = this.globalData;
|
|
1745
|
+
|
|
1746
|
+
this.$vm._isMounted = true;
|
|
1747
|
+
this.$vm.__call_hook('mounted', args);
|
|
1748
|
+
|
|
1749
|
+
this.$vm.__call_hook('onLaunch', args);
|
|
1750
|
+
}
|
|
1751
|
+
};
|
|
1752
|
+
|
|
1753
|
+
// 兼容旧版本 globalData
|
|
1754
|
+
appOptions.globalData = vm.$options.globalData || {};
|
|
1755
|
+
// 将 methods 中的方法挂在 getApp() 中
|
|
1756
|
+
const methods = vm.$options.methods;
|
|
1757
|
+
if (methods) {
|
|
1758
|
+
Object.keys(methods).forEach(name => {
|
|
1759
|
+
appOptions[name] = methods[name];
|
|
1760
|
+
});
|
|
1761
|
+
}
|
|
1762
|
+
|
|
1763
|
+
initAppLocale(Vue, vm, wx.getSystemInfoSync().language || 'zh-Hans');
|
|
1764
|
+
|
|
1765
|
+
initHooks(appOptions, hooks);
|
|
1766
|
+
|
|
1767
|
+
return appOptions
|
|
1364
1768
|
}
|
|
1365
1769
|
|
|
1366
1770
|
const mocks = ['__route__', '__wxExparserNodeId__', '__wxWebviewId__'];
|
|
@@ -1689,6 +2093,7 @@ function createSubpackageApp (vm) {
|
|
|
1689
2093
|
const app = getApp({
|
|
1690
2094
|
allowDefault: true
|
|
1691
2095
|
});
|
|
2096
|
+
vm.$scope = app;
|
|
1692
2097
|
const globalData = app.globalData;
|
|
1693
2098
|
if (globalData) {
|
|
1694
2099
|
Object.keys(appOptions.globalData).forEach(name => {
|
|
@@ -1703,18 +2108,18 @@ function createSubpackageApp (vm) {
|
|
|
1703
2108
|
}
|
|
1704
2109
|
});
|
|
1705
2110
|
if (isFn(appOptions.onShow) && wx.onAppShow) {
|
|
1706
|
-
wx.onAppShow((...args) => {
|
|
1707
|
-
|
|
2111
|
+
wx.onAppShow((...args) => {
|
|
2112
|
+
vm.__call_hook('onShow', args);
|
|
1708
2113
|
});
|
|
1709
2114
|
}
|
|
1710
2115
|
if (isFn(appOptions.onHide) && wx.onAppHide) {
|
|
1711
|
-
wx.onAppHide((...args) => {
|
|
1712
|
-
|
|
2116
|
+
wx.onAppHide((...args) => {
|
|
2117
|
+
vm.__call_hook('onHide', args);
|
|
1713
2118
|
});
|
|
1714
2119
|
}
|
|
1715
2120
|
if (isFn(appOptions.onLaunch)) {
|
|
1716
2121
|
const args = wx.getLaunchOptionsSync && wx.getLaunchOptionsSync();
|
|
1717
|
-
|
|
2122
|
+
vm.__call_hook('onLaunch', args);
|
|
1718
2123
|
}
|
|
1719
2124
|
return vm
|
|
1720
2125
|
}
|
|
@@ -1750,10 +2155,10 @@ canIUses.forEach(canIUseApi => {
|
|
|
1750
2155
|
}
|
|
1751
2156
|
});
|
|
1752
2157
|
|
|
1753
|
-
let uni = {};
|
|
2158
|
+
let uni$1 = {};
|
|
1754
2159
|
|
|
1755
2160
|
if (typeof Proxy !== 'undefined' && "app-plus" !== 'app-plus') {
|
|
1756
|
-
uni = new Proxy({}, {
|
|
2161
|
+
uni$1 = new Proxy({}, {
|
|
1757
2162
|
get (target, name) {
|
|
1758
2163
|
if (hasOwn(target, name)) {
|
|
1759
2164
|
return target[name]
|
|
@@ -1779,27 +2184,27 @@ if (typeof Proxy !== 'undefined' && "app-plus" !== 'app-plus') {
|
|
|
1779
2184
|
});
|
|
1780
2185
|
} else {
|
|
1781
2186
|
Object.keys(baseApi).forEach(name => {
|
|
1782
|
-
uni[name] = baseApi[name];
|
|
2187
|
+
uni$1[name] = baseApi[name];
|
|
1783
2188
|
});
|
|
1784
2189
|
|
|
1785
2190
|
Object.keys(eventApi).forEach(name => {
|
|
1786
|
-
uni[name] = eventApi[name];
|
|
2191
|
+
uni$1[name] = eventApi[name];
|
|
1787
2192
|
});
|
|
1788
2193
|
|
|
1789
2194
|
Object.keys(api).forEach(name => {
|
|
1790
|
-
uni[name] = promisify(name, api[name]);
|
|
2195
|
+
uni$1[name] = promisify(name, api[name]);
|
|
1791
2196
|
});
|
|
1792
2197
|
|
|
1793
2198
|
Object.keys(wx).forEach(name => {
|
|
1794
2199
|
if (hasOwn(wx, name) || hasOwn(protocols, name)) {
|
|
1795
|
-
uni[name] = promisify(name, wrapper(name, wx[name]));
|
|
2200
|
+
uni$1[name] = promisify(name, wrapper(name, wx[name]));
|
|
1796
2201
|
}
|
|
1797
2202
|
});
|
|
1798
2203
|
}
|
|
1799
2204
|
|
|
1800
2205
|
{
|
|
1801
2206
|
if (typeof global !== 'undefined') {
|
|
1802
|
-
global.uni = uni;
|
|
2207
|
+
global.uni = uni$1;
|
|
1803
2208
|
global.UniEmitter = eventApi;
|
|
1804
2209
|
}
|
|
1805
2210
|
}
|
|
@@ -1810,7 +2215,7 @@ wx.createComponent = createComponent;
|
|
|
1810
2215
|
wx.createSubpackageApp = createSubpackageApp;
|
|
1811
2216
|
wx.createPlugin = createPlugin;
|
|
1812
2217
|
|
|
1813
|
-
var uni$
|
|
2218
|
+
var uni$2 = uni$1;
|
|
1814
2219
|
|
|
1815
|
-
export default uni$
|
|
2220
|
+
export default uni$2;
|
|
1816
2221
|
export { createApp, createComponent, createPage, createPlugin, createSubpackageApp };
|