@dcloudio/uni-app-plus 2.0.0 → 2.0.1-32920211122002
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 +505 -138
- package/dist/index.v3.js +1262 -365
- 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$|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,245 @@ 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.button.save": "Save Image",
|
|
1320
|
+
"uni.previewImage.save.success": "Saved successfully",
|
|
1321
|
+
"uni.previewImage.save.fail": "Save failed",
|
|
1322
|
+
"uni.setClipboardData.success": "Content copied",
|
|
1323
|
+
"uni.scanCode.title": "Scan code",
|
|
1324
|
+
"uni.scanCode.album": "Album",
|
|
1325
|
+
"uni.scanCode.fail": "Recognition failure",
|
|
1326
|
+
"uni.scanCode.flash.on": "Tap to turn light on",
|
|
1327
|
+
"uni.scanCode.flash.off": "Tap to turn light off",
|
|
1328
|
+
"uni.startSoterAuthentication.authContent": "Fingerprint recognition",
|
|
1329
|
+
"uni.picker.done": "Done",
|
|
1330
|
+
"uni.picker.cancel": "Cancel",
|
|
1331
|
+
"uni.video.danmu": "Danmu",
|
|
1332
|
+
"uni.video.volume": "Volume",
|
|
1333
|
+
"uni.button.feedback.title": "feedback",
|
|
1334
|
+
"uni.button.feedback.send": "send",
|
|
1335
|
+
"uni.chooseLocation.search": "Find Place",
|
|
1336
|
+
"uni.chooseLocation.cancel": "Cancel"
|
|
1337
|
+
};
|
|
1338
|
+
|
|
1339
|
+
var es = {
|
|
1340
|
+
"uni.app.quit": "Pulse otra vez para salir",
|
|
1341
|
+
"uni.async.error": "Se agotó el tiempo de conexión, haga clic en la pantalla para volver a intentarlo.",
|
|
1342
|
+
"uni.showActionSheet.cancel": "Cancelar",
|
|
1343
|
+
"uni.showToast.unpaired": "Tenga en cuenta que showToast debe estar emparejado con hideToast",
|
|
1344
|
+
"uni.showLoading.unpaired": "Tenga en cuenta que showLoading debe estar emparejado con hideLoading",
|
|
1345
|
+
"uni.showModal.cancel": "Cancelar",
|
|
1346
|
+
"uni.showModal.confirm": "OK",
|
|
1347
|
+
"uni.chooseImage.cancel": "Cancelar",
|
|
1348
|
+
"uni.chooseImage.sourceType.album": "Álbum",
|
|
1349
|
+
"uni.chooseImage.sourceType.camera": "Cámara",
|
|
1350
|
+
"uni.chooseVideo.cancel": "Cancelar",
|
|
1351
|
+
"uni.chooseVideo.sourceType.album": "Álbum",
|
|
1352
|
+
"uni.chooseVideo.sourceType.camera": "Cámara",
|
|
1353
|
+
"uni.chooseFile.notUserActivation": "El cuadro de diálogo del selector de archivos solo se puede mostrar con la activación del usuario",
|
|
1354
|
+
"uni.previewImage.cancel": "Cancelar",
|
|
1355
|
+
"uni.previewImage.button.save": "Guardar imagen",
|
|
1356
|
+
"uni.previewImage.save.success": "Guardado exitosamente",
|
|
1357
|
+
"uni.previewImage.save.fail": "Error al guardar",
|
|
1358
|
+
"uni.setClipboardData.success": "Contenido copiado",
|
|
1359
|
+
"uni.scanCode.title": "Código de escaneo",
|
|
1360
|
+
"uni.scanCode.album": "Álbum",
|
|
1361
|
+
"uni.scanCode.fail": "Échec de la reconnaissance",
|
|
1362
|
+
"uni.scanCode.flash.on": "Toque para encender la luz",
|
|
1363
|
+
"uni.scanCode.flash.off": "Toque para apagar la luz",
|
|
1364
|
+
"uni.startSoterAuthentication.authContent": "Reconocimiento de huellas dactilares",
|
|
1365
|
+
"uni.picker.done": "OK",
|
|
1366
|
+
"uni.picker.cancel": "Cancelar",
|
|
1367
|
+
"uni.video.danmu": "Danmu",
|
|
1368
|
+
"uni.video.volume": "Volumen",
|
|
1369
|
+
"uni.button.feedback.title": "realimentación",
|
|
1370
|
+
"uni.button.feedback.send": "enviar",
|
|
1371
|
+
"uni.chooseLocation.search": "Encontrar",
|
|
1372
|
+
"uni.chooseLocation.cancel": "Cancelar"
|
|
1373
|
+
};
|
|
1374
|
+
|
|
1375
|
+
var fr = {
|
|
1376
|
+
"uni.app.quit": "Appuyez à nouveau pour quitter l'application",
|
|
1377
|
+
"uni.async.error": "La connexion a expiré, cliquez sur l'écran pour réessayer.",
|
|
1378
|
+
"uni.showActionSheet.cancel": "Annuler",
|
|
1379
|
+
"uni.showToast.unpaired": "Veuillez noter que showToast doit être associé à hideToast",
|
|
1380
|
+
"uni.showLoading.unpaired": "Veuillez noter que showLoading doit être associé à hideLoading",
|
|
1381
|
+
"uni.showModal.cancel": "Annuler",
|
|
1382
|
+
"uni.showModal.confirm": "OK",
|
|
1383
|
+
"uni.chooseImage.cancel": "Annuler",
|
|
1384
|
+
"uni.chooseImage.sourceType.album": "Album",
|
|
1385
|
+
"uni.chooseImage.sourceType.camera": "Caméra",
|
|
1386
|
+
"uni.chooseVideo.cancel": "Annuler",
|
|
1387
|
+
"uni.chooseVideo.sourceType.album": "Album",
|
|
1388
|
+
"uni.chooseVideo.sourceType.camera": "Caméra",
|
|
1389
|
+
"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",
|
|
1390
|
+
"uni.previewImage.cancel": "Annuler",
|
|
1391
|
+
"uni.previewImage.button.save": "Guardar imagen",
|
|
1392
|
+
"uni.previewImage.save.success": "Enregistré avec succès",
|
|
1393
|
+
"uni.previewImage.save.fail": "Échec de la sauvegarde",
|
|
1394
|
+
"uni.setClipboardData.success": "Contenu copié",
|
|
1395
|
+
"uni.scanCode.title": "Code d’analyse",
|
|
1396
|
+
"uni.scanCode.album": "Album",
|
|
1397
|
+
"uni.scanCode.fail": "Fallo de reconocimiento",
|
|
1398
|
+
"uni.scanCode.flash.on": "Appuyez pour activer l'éclairage",
|
|
1399
|
+
"uni.scanCode.flash.off": "Appuyez pour désactiver l'éclairage",
|
|
1400
|
+
"uni.startSoterAuthentication.authContent": "Reconnaissance de l'empreinte digitale",
|
|
1401
|
+
"uni.picker.done": "OK",
|
|
1402
|
+
"uni.picker.cancel": "Annuler",
|
|
1403
|
+
"uni.video.danmu": "Danmu",
|
|
1404
|
+
"uni.video.volume": "Le Volume",
|
|
1405
|
+
"uni.button.feedback.title": "retour d'information",
|
|
1406
|
+
"uni.button.feedback.send": "envoyer",
|
|
1407
|
+
"uni.chooseLocation.search": "Trouve",
|
|
1408
|
+
"uni.chooseLocation.cancel": "Annuler"
|
|
1409
|
+
};
|
|
1410
|
+
|
|
1411
|
+
var zhHans = {
|
|
1412
|
+
"uni.app.quit": "再按一次退出应用",
|
|
1413
|
+
"uni.async.error": "连接服务器超时,点击屏幕重试",
|
|
1414
|
+
"uni.showActionSheet.cancel": "取消",
|
|
1415
|
+
"uni.showToast.unpaired": "请注意 showToast 与 hideToast 必须配对使用",
|
|
1416
|
+
"uni.showLoading.unpaired": "请注意 showLoading 与 hideLoading 必须配对使用",
|
|
1417
|
+
"uni.showModal.cancel": "取消",
|
|
1418
|
+
"uni.showModal.confirm": "确定",
|
|
1419
|
+
"uni.chooseImage.cancel": "取消",
|
|
1420
|
+
"uni.chooseImage.sourceType.album": "从相册选择",
|
|
1421
|
+
"uni.chooseImage.sourceType.camera": "拍摄",
|
|
1422
|
+
"uni.chooseVideo.cancel": "取消",
|
|
1423
|
+
"uni.chooseVideo.sourceType.album": "从相册选择",
|
|
1424
|
+
"uni.chooseVideo.sourceType.camera": "拍摄",
|
|
1425
|
+
"uni.chooseFile.notUserActivation": "文件选择器对话框只能在用户激活时显示",
|
|
1426
|
+
"uni.previewImage.cancel": "取消",
|
|
1427
|
+
"uni.previewImage.button.save": "保存图像",
|
|
1428
|
+
"uni.previewImage.save.success": "保存图像到相册成功",
|
|
1429
|
+
"uni.previewImage.save.fail": "保存图像到相册失败",
|
|
1430
|
+
"uni.setClipboardData.success": "内容已复制",
|
|
1431
|
+
"uni.scanCode.title": "扫码",
|
|
1432
|
+
"uni.scanCode.album": "相册",
|
|
1433
|
+
"uni.scanCode.fail": "识别失败",
|
|
1434
|
+
"uni.scanCode.flash.on": "轻触照亮",
|
|
1435
|
+
"uni.scanCode.flash.off": "轻触关闭",
|
|
1436
|
+
"uni.startSoterAuthentication.authContent": "指纹识别中...",
|
|
1437
|
+
"uni.picker.done": "完成",
|
|
1438
|
+
"uni.picker.cancel": "取消",
|
|
1439
|
+
"uni.video.danmu": "弹幕",
|
|
1440
|
+
"uni.video.volume": "音量",
|
|
1441
|
+
"uni.button.feedback.title": "问题反馈",
|
|
1442
|
+
"uni.button.feedback.send": "发送",
|
|
1443
|
+
"uni.chooseLocation.search": "搜索地点",
|
|
1444
|
+
"uni.chooseLocation.cancel": "取消"
|
|
1445
|
+
};
|
|
1446
|
+
|
|
1447
|
+
var zhHant = {
|
|
1448
|
+
"uni.app.quit": "再按一次退出應用",
|
|
1449
|
+
"uni.async.error": "連接服務器超時,點擊屏幕重試",
|
|
1450
|
+
"uni.showActionSheet.cancel": "取消",
|
|
1451
|
+
"uni.showToast.unpaired": "請注意 showToast 與 hideToast 必須配對使用",
|
|
1452
|
+
"uni.showLoading.unpaired": "請注意 showLoading 與 hideLoading 必須配對使用",
|
|
1453
|
+
"uni.showModal.cancel": "取消",
|
|
1454
|
+
"uni.showModal.confirm": "確定",
|
|
1455
|
+
"uni.chooseImage.cancel": "取消",
|
|
1456
|
+
"uni.chooseImage.sourceType.album": "從相冊選擇",
|
|
1457
|
+
"uni.chooseImage.sourceType.camera": "拍攝",
|
|
1458
|
+
"uni.chooseVideo.cancel": "取消",
|
|
1459
|
+
"uni.chooseVideo.sourceType.album": "從相冊選擇",
|
|
1460
|
+
"uni.chooseVideo.sourceType.camera": "拍攝",
|
|
1461
|
+
"uni.chooseFile.notUserActivation": "文件選擇器對話框只能在用戶激活時顯示",
|
|
1462
|
+
"uni.previewImage.cancel": "取消",
|
|
1463
|
+
"uni.previewImage.button.save": "保存圖像",
|
|
1464
|
+
"uni.previewImage.save.success": "保存圖像到相冊成功",
|
|
1465
|
+
"uni.previewImage.save.fail": "保存圖像到相冊失敗",
|
|
1466
|
+
"uni.setClipboardData.success": "內容已復制",
|
|
1467
|
+
"uni.scanCode.title": "掃碼",
|
|
1468
|
+
"uni.scanCode.album": "相冊",
|
|
1469
|
+
"uni.scanCode.fail": "識別失敗",
|
|
1470
|
+
"uni.scanCode.flash.on": "輕觸照亮",
|
|
1471
|
+
"uni.scanCode.flash.off": "輕觸關閉",
|
|
1472
|
+
"uni.startSoterAuthentication.authContent": "指紋識別中...",
|
|
1473
|
+
"uni.picker.done": "完成",
|
|
1474
|
+
"uni.picker.cancel": "取消",
|
|
1475
|
+
"uni.video.danmu": "彈幕",
|
|
1476
|
+
"uni.video.volume": "音量",
|
|
1477
|
+
"uni.button.feedback.title": "問題反饋",
|
|
1478
|
+
"uni.button.feedback.send": "發送",
|
|
1479
|
+
"uni.chooseLocation.search": "搜索地點",
|
|
1480
|
+
"uni.chooseLocation.cancel": "取消"
|
|
1481
|
+
};
|
|
1482
|
+
|
|
1483
|
+
const messages = {
|
|
1484
|
+
en,
|
|
1485
|
+
es,
|
|
1486
|
+
fr,
|
|
1487
|
+
'zh-Hans': zhHans,
|
|
1488
|
+
'zh-Hant': zhHant
|
|
1489
|
+
};
|
|
1490
|
+
|
|
1491
|
+
let locale;
|
|
1492
|
+
|
|
1493
|
+
{
|
|
1494
|
+
if (typeof weex === 'object') {
|
|
1495
|
+
locale = weex.requireModule('plus').getLanguage();
|
|
1496
|
+
} else {
|
|
1497
|
+
locale = '';
|
|
1498
|
+
}
|
|
1499
|
+
}
|
|
1500
|
+
|
|
1501
|
+
const i18n = initVueI18n(
|
|
1502
|
+
locale,
|
|
1503
|
+
messages
|
|
1504
|
+
);
|
|
1505
|
+
const t = i18n.t;
|
|
1506
|
+
const i18nMixin = (i18n.mixin = {
|
|
1507
|
+
beforeCreate () {
|
|
1508
|
+
const unwatch = i18n.i18n.watchLocale(() => {
|
|
1509
|
+
this.$forceUpdate();
|
|
1510
|
+
});
|
|
1511
|
+
this.$once('hook:beforeDestroy', function () {
|
|
1512
|
+
unwatch();
|
|
1513
|
+
});
|
|
1514
|
+
},
|
|
1515
|
+
methods: {
|
|
1516
|
+
$$t (key, values) {
|
|
1517
|
+
return t(key, values)
|
|
1518
|
+
}
|
|
1519
|
+
}
|
|
1520
|
+
});
|
|
1521
|
+
const setLocale$1 = i18n.setLocale;
|
|
1522
|
+
const getLocale$1 = i18n.getLocale;
|
|
1523
|
+
|
|
1524
|
+
function initAppLocale (Vue, appVm, locale) {
|
|
1525
|
+
const state = Vue.observable({
|
|
1526
|
+
locale: locale || i18n.getLocale()
|
|
1527
|
+
});
|
|
1528
|
+
const localeWatchers = [];
|
|
1529
|
+
appVm.$watchLocale = fn => {
|
|
1530
|
+
localeWatchers.push(fn);
|
|
1531
|
+
};
|
|
1532
|
+
Object.defineProperty(appVm, '$locale', {
|
|
1533
|
+
get () {
|
|
1534
|
+
return state.locale
|
|
1535
|
+
},
|
|
1536
|
+
set (v) {
|
|
1537
|
+
state.locale = v;
|
|
1538
|
+
localeWatchers.forEach(watch => watch(v));
|
|
1539
|
+
}
|
|
1540
|
+
});
|
|
1541
|
+
}
|
|
1542
|
+
|
|
1180
1543
|
class EventChannel {
|
|
1181
1544
|
constructor (id, events) {
|
|
1182
1545
|
this.id = id;
|
|
@@ -1258,109 +1621,112 @@ function getEventChannel (id) {
|
|
|
1258
1621
|
return eventChannelStack.shift()
|
|
1259
1622
|
}
|
|
1260
1623
|
|
|
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
|
-
|
|
1624
|
+
const hooks = [
|
|
1625
|
+
'onShow',
|
|
1626
|
+
'onHide',
|
|
1627
|
+
'onError',
|
|
1628
|
+
'onPageNotFound',
|
|
1629
|
+
'onThemeChange',
|
|
1630
|
+
'onUnhandledRejection'
|
|
1631
|
+
];
|
|
1632
|
+
|
|
1633
|
+
function initEventChannel () {
|
|
1634
|
+
Vue.prototype.getOpenerEventChannel = function () {
|
|
1635
|
+
if (!this.__eventChannel__) {
|
|
1636
|
+
this.__eventChannel__ = new EventChannel();
|
|
1637
|
+
}
|
|
1638
|
+
return this.__eventChannel__
|
|
1639
|
+
};
|
|
1640
|
+
const callHook = Vue.prototype.__call_hook;
|
|
1641
|
+
Vue.prototype.__call_hook = function (hook, args) {
|
|
1642
|
+
if (hook === 'onLoad' && args && args.__id__) {
|
|
1643
|
+
this.__eventChannel__ = getEventChannel(args.__id__);
|
|
1644
|
+
delete args.__id__;
|
|
1645
|
+
}
|
|
1646
|
+
return callHook.call(this, hook, args)
|
|
1647
|
+
};
|
|
1648
|
+
}
|
|
1649
|
+
|
|
1650
|
+
function parseBaseApp (vm, {
|
|
1651
|
+
mocks,
|
|
1652
|
+
initRefs
|
|
1653
|
+
}) {
|
|
1654
|
+
initEventChannel();
|
|
1655
|
+
if (vm.$options.store) {
|
|
1656
|
+
Vue.prototype.$store = vm.$options.store;
|
|
1657
|
+
}
|
|
1658
|
+
uniIdMixin(Vue);
|
|
1659
|
+
|
|
1660
|
+
Vue.prototype.mpHost = "app-plus";
|
|
1661
|
+
|
|
1662
|
+
Vue.mixin({
|
|
1663
|
+
beforeCreate () {
|
|
1664
|
+
if (!this.$options.mpType) {
|
|
1665
|
+
return
|
|
1666
|
+
}
|
|
1667
|
+
|
|
1668
|
+
this.mpType = this.$options.mpType;
|
|
1669
|
+
|
|
1670
|
+
this.$mp = {
|
|
1671
|
+
data: {},
|
|
1672
|
+
[this.mpType]: this.$options.mpInstance
|
|
1673
|
+
};
|
|
1674
|
+
|
|
1675
|
+
this.$scope = this.$options.mpInstance;
|
|
1676
|
+
|
|
1677
|
+
delete this.$options.mpType;
|
|
1678
|
+
delete this.$options.mpInstance;
|
|
1679
|
+
if (this.mpType === 'page' && typeof getApp === 'function') { // hack vue-i18n
|
|
1680
|
+
const app = getApp();
|
|
1681
|
+
if (app.$vm && app.$vm.$i18n) {
|
|
1682
|
+
this._i18n = app.$vm.$i18n;
|
|
1683
|
+
}
|
|
1684
|
+
}
|
|
1685
|
+
if (this.mpType !== 'app') {
|
|
1686
|
+
initRefs(this);
|
|
1687
|
+
initMocks(this, mocks);
|
|
1688
|
+
}
|
|
1689
|
+
}
|
|
1690
|
+
});
|
|
1691
|
+
|
|
1692
|
+
const appOptions = {
|
|
1693
|
+
onLaunch (args) {
|
|
1694
|
+
if (this.$vm) { // 已经初始化过了,主要是为了百度,百度 onShow 在 onLaunch 之前
|
|
1695
|
+
return
|
|
1696
|
+
}
|
|
1697
|
+
|
|
1698
|
+
this.$vm = vm;
|
|
1699
|
+
|
|
1700
|
+
this.$vm.$mp = {
|
|
1701
|
+
app: this
|
|
1702
|
+
};
|
|
1703
|
+
|
|
1704
|
+
this.$vm.$scope = this;
|
|
1705
|
+
// vm 上也挂载 globalData
|
|
1706
|
+
this.$vm.globalData = this.globalData;
|
|
1707
|
+
|
|
1708
|
+
this.$vm._isMounted = true;
|
|
1709
|
+
this.$vm.__call_hook('mounted', args);
|
|
1710
|
+
|
|
1711
|
+
this.$vm.__call_hook('onLaunch', args);
|
|
1712
|
+
}
|
|
1713
|
+
};
|
|
1714
|
+
|
|
1715
|
+
// 兼容旧版本 globalData
|
|
1716
|
+
appOptions.globalData = vm.$options.globalData || {};
|
|
1717
|
+
// 将 methods 中的方法挂在 getApp() 中
|
|
1718
|
+
const methods = vm.$options.methods;
|
|
1719
|
+
if (methods) {
|
|
1720
|
+
Object.keys(methods).forEach(name => {
|
|
1721
|
+
appOptions[name] = methods[name];
|
|
1722
|
+
});
|
|
1723
|
+
}
|
|
1724
|
+
|
|
1725
|
+
initAppLocale(Vue, vm, wx.getSystemInfoSync().language || 'zh-Hans');
|
|
1726
|
+
|
|
1727
|
+
initHooks(appOptions, hooks);
|
|
1728
|
+
|
|
1729
|
+
return appOptions
|
|
1364
1730
|
}
|
|
1365
1731
|
|
|
1366
1732
|
const mocks = ['__route__', '__wxExparserNodeId__', '__wxWebviewId__'];
|
|
@@ -1689,6 +2055,7 @@ function createSubpackageApp (vm) {
|
|
|
1689
2055
|
const app = getApp({
|
|
1690
2056
|
allowDefault: true
|
|
1691
2057
|
});
|
|
2058
|
+
vm.$scope = app;
|
|
1692
2059
|
const globalData = app.globalData;
|
|
1693
2060
|
if (globalData) {
|
|
1694
2061
|
Object.keys(appOptions.globalData).forEach(name => {
|
|
@@ -1703,18 +2070,18 @@ function createSubpackageApp (vm) {
|
|
|
1703
2070
|
}
|
|
1704
2071
|
});
|
|
1705
2072
|
if (isFn(appOptions.onShow) && wx.onAppShow) {
|
|
1706
|
-
wx.onAppShow((...args) => {
|
|
1707
|
-
|
|
2073
|
+
wx.onAppShow((...args) => {
|
|
2074
|
+
vm.__call_hook('onShow', args);
|
|
1708
2075
|
});
|
|
1709
2076
|
}
|
|
1710
2077
|
if (isFn(appOptions.onHide) && wx.onAppHide) {
|
|
1711
|
-
wx.onAppHide((...args) => {
|
|
1712
|
-
|
|
2078
|
+
wx.onAppHide((...args) => {
|
|
2079
|
+
vm.__call_hook('onHide', args);
|
|
1713
2080
|
});
|
|
1714
2081
|
}
|
|
1715
2082
|
if (isFn(appOptions.onLaunch)) {
|
|
1716
2083
|
const args = wx.getLaunchOptionsSync && wx.getLaunchOptionsSync();
|
|
1717
|
-
|
|
2084
|
+
vm.__call_hook('onLaunch', args);
|
|
1718
2085
|
}
|
|
1719
2086
|
return vm
|
|
1720
2087
|
}
|
|
@@ -1750,10 +2117,10 @@ canIUses.forEach(canIUseApi => {
|
|
|
1750
2117
|
}
|
|
1751
2118
|
});
|
|
1752
2119
|
|
|
1753
|
-
let uni = {};
|
|
2120
|
+
let uni$1 = {};
|
|
1754
2121
|
|
|
1755
2122
|
if (typeof Proxy !== 'undefined' && "app-plus" !== 'app-plus') {
|
|
1756
|
-
uni = new Proxy({}, {
|
|
2123
|
+
uni$1 = new Proxy({}, {
|
|
1757
2124
|
get (target, name) {
|
|
1758
2125
|
if (hasOwn(target, name)) {
|
|
1759
2126
|
return target[name]
|
|
@@ -1779,27 +2146,27 @@ if (typeof Proxy !== 'undefined' && "app-plus" !== 'app-plus') {
|
|
|
1779
2146
|
});
|
|
1780
2147
|
} else {
|
|
1781
2148
|
Object.keys(baseApi).forEach(name => {
|
|
1782
|
-
uni[name] = baseApi[name];
|
|
2149
|
+
uni$1[name] = baseApi[name];
|
|
1783
2150
|
});
|
|
1784
2151
|
|
|
1785
2152
|
Object.keys(eventApi).forEach(name => {
|
|
1786
|
-
uni[name] = eventApi[name];
|
|
2153
|
+
uni$1[name] = eventApi[name];
|
|
1787
2154
|
});
|
|
1788
2155
|
|
|
1789
2156
|
Object.keys(api).forEach(name => {
|
|
1790
|
-
uni[name] = promisify(name, api[name]);
|
|
2157
|
+
uni$1[name] = promisify(name, api[name]);
|
|
1791
2158
|
});
|
|
1792
2159
|
|
|
1793
2160
|
Object.keys(wx).forEach(name => {
|
|
1794
2161
|
if (hasOwn(wx, name) || hasOwn(protocols, name)) {
|
|
1795
|
-
uni[name] = promisify(name, wrapper(name, wx[name]));
|
|
2162
|
+
uni$1[name] = promisify(name, wrapper(name, wx[name]));
|
|
1796
2163
|
}
|
|
1797
2164
|
});
|
|
1798
2165
|
}
|
|
1799
2166
|
|
|
1800
2167
|
{
|
|
1801
2168
|
if (typeof global !== 'undefined') {
|
|
1802
|
-
global.uni = uni;
|
|
2169
|
+
global.uni = uni$1;
|
|
1803
2170
|
global.UniEmitter = eventApi;
|
|
1804
2171
|
}
|
|
1805
2172
|
}
|
|
@@ -1810,7 +2177,7 @@ wx.createComponent = createComponent;
|
|
|
1810
2177
|
wx.createSubpackageApp = createSubpackageApp;
|
|
1811
2178
|
wx.createPlugin = createPlugin;
|
|
1812
2179
|
|
|
1813
|
-
var uni$
|
|
2180
|
+
var uni$2 = uni$1;
|
|
1814
2181
|
|
|
1815
|
-
export default uni$
|
|
2182
|
+
export default uni$2;
|
|
1816
2183
|
export { createApp, createComponent, createPage, createPlugin, createSubpackageApp };
|