@wiajs/core 0.1.12 → 0.1.16

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/core.esm.js CHANGED
@@ -1,6 +1,6 @@
1
1
  /*!
2
- * wia core v0.1.12
3
- * (c) 2020 Sibyl Yu
2
+ * wia core v0.1.16
3
+ * (c) 2021 Sibyl Yu
4
4
  * @license MIT
5
5
  */
6
6
  /**
@@ -8,9 +8,7 @@
8
8
  * return Promise objext.
9
9
  * get move to base.js
10
10
  */
11
- var Ajax =
12
- /*#__PURE__*/
13
- function () {
11
+ var Ajax = /*#__PURE__*/function () {
14
12
  function Ajax() {}
15
13
 
16
14
  var _proto = Ajax.prototype;
@@ -116,7 +114,8 @@ function _createClass(Constructor, protoProps, staticProps) {
116
114
  function _inheritsLoose(subClass, superClass) {
117
115
  subClass.prototype = Object.create(superClass.prototype);
118
116
  subClass.prototype.constructor = subClass;
119
- subClass.__proto__ = superClass;
117
+
118
+ _setPrototypeOf(subClass, superClass);
120
119
  }
121
120
 
122
121
  function _setPrototypeOf(o, p) {
@@ -128,13 +127,13 @@ function _setPrototypeOf(o, p) {
128
127
  return _setPrototypeOf(o, p);
129
128
  }
130
129
 
131
- function isNativeReflectConstruct() {
130
+ function _isNativeReflectConstruct() {
132
131
  if (typeof Reflect === "undefined" || !Reflect.construct) return false;
133
132
  if (Reflect.construct.sham) return false;
134
133
  if (typeof Proxy === "function") return true;
135
134
 
136
135
  try {
137
- Date.prototype.toString.call(Reflect.construct(Date, [], function () {}));
136
+ Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {}));
138
137
  return true;
139
138
  } catch (e) {
140
139
  return false;
@@ -142,7 +141,7 @@ function isNativeReflectConstruct() {
142
141
  }
143
142
 
144
143
  function _construct(Parent, args, Class) {
145
- if (isNativeReflectConstruct()) {
144
+ if (_isNativeReflectConstruct()) {
146
145
  _construct = Reflect.construct;
147
146
  } else {
148
147
  _construct = function _construct(Parent, args, Class) {
@@ -184,8 +183,8 @@ var Utils = {
184
183
 
185
184
  return $.uid(mask, map);
186
185
  },
187
- mdPreloaderContent: "\n <span class=\"preloader-inner\">\n <span class=\"preloader-inner-gap\"></span>\n <span class=\"preloader-inner-left\">\n <span class=\"preloader-inner-half-circle\"></span>\n </span>\n <span class=\"preloader-inner-right\">\n <span class=\"preloader-inner-half-circle\"></span>\n </span>\n </span>\n ".trim(),
188
- iosPreloaderContent: ("\n <span class=\"preloader-inner\">\n " + [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11].map(function () {
186
+ mdPreloaderContent: "\n <span class=\"preloader-inner\">\n\t\t\t<svg viewBox=\"0 0 36 36\">\n\t\t\t\t<circle cx=\"18\" cy=\"18\" r=\"16\"></circle>\n\t\t\t</svg>\n </span>\n ".trim(),
187
+ iosPreloaderContent: ("\n <span class=\"preloader-inner\">\n\t\t\t" + [0, 1, 2, 3, 4, 5, 6, 7].map(function () {
189
188
  return '<span class="preloader-inner-line"></span>';
190
189
  }).join('') + "\n </span>\n ").trim(),
191
190
  auroraPreloaderContent: "\n <span class=\"preloader-inner\">\n <span class=\"preloader-inner-circle\"></span>\n </span>\n ",
@@ -312,6 +311,22 @@ var Utils = {
312
311
  args.splice(0, 1);
313
312
  return (_$2 = $).assign.apply(_$2, [to].concat(args));
314
313
  },
314
+ // ���෽������ʵ�������������ԡ���������
315
+ bindMethods: function bindMethods(instance, obj) {
316
+ var _this = this;
317
+
318
+ Object.keys(obj).forEach(function (key) {
319
+ if (_this.isObject(obj[key])) {
320
+ Object.keys(obj[key]).forEach(function (subKey) {
321
+ if (typeof obj[key][subKey] === 'function') {
322
+ obj[key][subKey] = obj[key][subKey].bind(instance);
323
+ }
324
+ });
325
+ }
326
+
327
+ instance[key] = obj[key];
328
+ });
329
+ },
315
330
  colorHexToRgb: function colorHexToRgb(hex) {
316
331
  var h = hex.replace(/^#?([a-f\d])([a-f\d])([a-f\d])$/i, function (m, r, g, b) {
317
332
  return r + r + g + g + b + b;
@@ -427,9 +442,7 @@ var Utils = {
427
442
  * 需要支持事件的对象,可以从这个类继承,则类实例具备事件功能。
428
443
  * Fork from Framework7,
429
444
  */
430
- var Event =
431
- /*#__PURE__*/
432
- function () {
445
+ var Event = /*#__PURE__*/function () {
433
446
  function Event(params, parents) {
434
447
  if (params === void 0) {
435
448
  params = {};
@@ -558,9 +571,7 @@ function () {
558
571
  return Event;
559
572
  }();
560
573
 
561
- var Module =
562
- /*#__PURE__*/
563
- function (_Event) {
574
+ var Module = /*#__PURE__*/function (_Event) {
564
575
  _inheritsLoose(Module, _Event);
565
576
 
566
577
  function Module(params, parents) {
@@ -604,7 +615,7 @@ function (_Event) {
604
615
  });
605
616
  }
606
617
  /**
607
- * 将扩展模块的相关事件加载到类实例
618
+ * 将扩展模块的相关方法、事件加载到类实例
608
619
  * @param {*} moduleName 扩展模块名称
609
620
  * @param {*} moduleParams
610
621
  */
@@ -635,7 +646,7 @@ function (_Event) {
635
646
  instance[modulePropName] = moduleProp;
636
647
  }
637
648
  });
638
- } // 将扩展模块中的on加载到事件侦听中,Add event listeners
649
+ } // 将扩展模块中的on加载到实例的事件侦听中,比如 init 在实例初始化时被调用
639
650
 
640
651
 
641
652
  if (module.on && instance.on) {
@@ -655,7 +666,7 @@ function (_Event) {
655
666
  instance.vnodeHooks[hookName][vnodeId].push(handler.bind(instance));
656
667
  });
657
668
  });
658
- } // 模块实例化回调,Module create callback
669
+ } // 执行模块的create方法,模块实例化回调,Module create callback
659
670
 
660
671
 
661
672
  if (module.create) {
@@ -663,7 +674,7 @@ function (_Event) {
663
674
  }
664
675
  }
665
676
  /**
666
- * 初始化实例原型中的所有扩展模块中定义的相关回调
677
+ * 实例创建初始化时,执行扩展模块中定义的相关回调
667
678
  * @param {*} modulesParams
668
679
  */
669
680
  ;
@@ -682,7 +693,7 @@ function (_Event) {
682
693
  };
683
694
 
684
695
  /**
685
- * 将模块类加载到指定类上,用于扩展类
696
+ * 将模块类装配到指定类的modules属性,用于扩展类
686
697
  * @param {*} module 模块类
687
698
  * @param {...any} params 参数
688
699
  */
@@ -764,7 +775,7 @@ function Constructors (parameters) {
764
775
 
765
776
  var _parameters = parameters,
766
777
  defaultSelector = _parameters.defaultSelector,
767
- constructor = _parameters.constructor,
778
+ Constructor = _parameters.constructor,
768
779
  domProp = _parameters.domProp,
769
780
  app = _parameters.app,
770
781
  addMethods = _parameters.addMethods;
@@ -774,15 +785,15 @@ function Constructors (parameters) {
774
785
  args[_key] = arguments[_key];
775
786
  }
776
787
 
777
- if (app) return _construct(constructor, [app].concat(args));
778
- return _construct(constructor, args);
788
+ if (app) return _construct(Constructor, [app].concat(args));
789
+ return _construct(Constructor, args);
779
790
  },
780
791
  get: function get(el) {
781
792
  if (el === void 0) {
782
793
  el = defaultSelector;
783
794
  }
784
795
 
785
- if (el instanceof constructor) return el;
796
+ if (el instanceof Constructor) return el;
786
797
  var $el = $(el);
787
798
  if ($el.length === 0) return undefined;
788
799
  return $el[0][domProp];
@@ -1111,7 +1122,7 @@ function initClicks(app) {
1111
1122
  var $clickedEl = $(e.target);
1112
1123
  var $clickedLinkEl = $clickedEl.closest('a');
1113
1124
  var isLink = $clickedLinkEl.length > 0;
1114
- var url = isLink && $clickedLinkEl.attr('href'); // call Modules Clicks
1125
+ isLink && $clickedLinkEl.attr('href'); // call Modules Clicks
1115
1126
 
1116
1127
  Object.keys(app.modules).forEach(function (moduleName) {
1117
1128
  var moduleClicks = app.modules[moduleName].clicks;
@@ -1237,44 +1248,35 @@ var SW$1 = {
1237
1248
  }
1238
1249
  };
1239
1250
 
1240
- var Support = $.support;
1241
- var Device = $.device;
1251
+ var Support$1 = $.support;
1252
+ var Device$1 = $.device;
1253
+ /**
1254
+ * 应用类,每个wia应用从该类继承,由 首页加载创建或者路由创建
1255
+ */
1242
1256
 
1243
- var App =
1244
- /*#__PURE__*/
1245
- function (_Module) {
1257
+ var App = /*#__PURE__*/function (_Module) {
1246
1258
  _inheritsLoose(App, _Module);
1247
1259
 
1248
- function App(params) {
1260
+ function App(opt) {
1249
1261
  var _this;
1250
1262
 
1251
- _this = _Module.call(this, params) || this;
1252
-
1253
- if (App.instance) {
1254
- throw new Error("App is already initialized and can't be initialized more than once");
1255
- }
1256
-
1257
- var passedParams = $.extend({}, params); // App Instance
1263
+ _this = _Module.call(this, opt) || this;
1264
+ var passedParams = $.extend({}, opt);
1258
1265
 
1259
1266
  var app = _assertThisInitialized(_this);
1260
1267
 
1261
- app.device = Device;
1262
- app.support = Support;
1263
- App.instance = app;
1264
- $.app = app;
1265
- $.App = App; // Default
1268
+ app.device = Device$1;
1269
+ app.support = Support$1; // Default
1266
1270
 
1267
- var defaults = {
1268
- version: '1.0.0',
1269
- id: 'pub.wia.testapp',
1271
+ var def = {
1272
+ version: '0.0.1',
1270
1273
  root: 'body',
1271
1274
  theme: 'auto',
1272
1275
  language: window.navigator.language,
1273
1276
  routes: [],
1274
- name: 'wia',
1275
1277
  lazyModulesPath: null,
1276
1278
  initOnDeviceReady: true,
1277
- init: true,
1279
+ // init: true, // 路由加载时,为 false,,为true
1278
1280
  autoDarkTheme: false,
1279
1281
  iosTranslucentBars: true,
1280
1282
  iosTranslucentModals: true,
@@ -1282,15 +1284,14 @@ function (_Module) {
1282
1284
  componentUrl: undefined
1283
1285
  }; // Extend defaults with modules params
1284
1286
 
1285
- app.useModulesParams(defaults); // Extend defaults with passed params
1287
+ app.useModulesParams(def); // Extend defaults with passed params
1286
1288
 
1287
- app.params = $.extend(defaults, params);
1289
+ app.params = $.extend(def, opt);
1288
1290
  var $rootEl = $(app.params.root);
1289
1291
  $.extend(app, {
1290
- // App Id
1291
- id: app.params.id,
1292
- // App Name
1292
+ owner: app.params.owner,
1293
1293
  name: app.params.name,
1294
+ id: app.params.owner + "." + app.params.name,
1294
1295
  // App version
1295
1296
  version: app.params.version,
1296
1297
  // Routes
@@ -1299,6 +1300,7 @@ function (_Module) {
1299
1300
  language: app.params.language,
1300
1301
  // Root
1301
1302
  root: $rootEl,
1303
+ $el: $rootEl,
1302
1304
  cfg: app.params.cfg,
1303
1305
  // app config
1304
1306
  api: app.params.api,
@@ -1308,8 +1310,8 @@ function (_Module) {
1308
1310
  // Theme
1309
1311
  theme: function getTheme() {
1310
1312
  if (app.params.theme === 'auto') {
1311
- if (Device.ios) return 'ios';
1312
- if (Device.desktop && Device.electron) return 'aurora';
1313
+ if (Device$1.ios) return 'ios';
1314
+ if (Device$1.desktop) return 'aurora';
1313
1315
  return 'md';
1314
1316
  }
1315
1317
 
@@ -1324,16 +1326,13 @@ function (_Module) {
1324
1326
  app.root[0].wia = app;
1325
1327
  }
1326
1328
 
1327
- if (Device.ios && Device.webView) {
1328
- // Strange hack required for iOS 8 webview to work on inputs
1329
- window.addEventListener('touchstart', function () {});
1330
- }
1331
-
1332
1329
  app.touchEvents = {
1333
- start: Support.touch ? 'touchstart' : Support.pointerEvents ? 'pointerdown' : 'mousedown',
1334
- move: Support.touch ? 'touchmove' : Support.pointerEvents ? 'pointermove' : 'mousemove',
1335
- end: Support.touch ? 'touchend' : Support.pointerEvents ? 'pointerup' : 'mouseup'
1336
- }; // 加载use插入的模块类相关方法(如:create、get、destroy),Load Use Modules
1330
+ start: Support$1.touch ? 'touchstart' : Support$1.pointerEvents ? 'pointerdown' : 'mousedown',
1331
+ move: Support$1.touch ? 'touchmove' : Support$1.pointerEvents ? 'pointermove' : 'mousemove',
1332
+ end: Support$1.touch ? 'touchend' : Support$1.pointerEvents ? 'pointerup' : 'mouseup'
1333
+ }; // 加载use插入的模块类,每个模块作为app的一个属性,合并到实例。
1334
+ // 模块包括相关属性及方法(如:create、get、destroy)
1335
+ // 调用每个模块的 create 方法
1337
1336
 
1338
1337
  app.useModules(); // 初始化数据,Init Data & Methods
1339
1338
 
@@ -1367,39 +1366,46 @@ function (_Module) {
1367
1366
 
1368
1367
 
1369
1368
  function init() {
1370
- if (Device.cordova && app.params.initOnDeviceReady) {
1369
+ if (Device$1.cordova && app.params.initOnDeviceReady) {
1371
1370
  $(document).on('deviceready', function () {
1372
1371
  app.init();
1373
1372
  });
1374
1373
  } else {
1375
1374
  app.init();
1376
1375
  }
1377
- }
1376
+ } // 应用初始化,路由跳转时不执行初始化
1378
1377
 
1379
- if (app.params.component || app.params.componentUrl) {
1380
- app.router.componentLoader(app.params.component, app.params.componentUrl, {
1381
- componentOptions: {
1382
- el: app.root[0]
1383
- }
1384
- }, function (el) {
1385
- app.root = $(el);
1386
- app.root[0].f7 = app;
1387
- app.rootComponent = el.f7Component;
1388
- if (app.params.init) init();
1389
- });
1390
- } else if (app.params.init) {
1391
- init();
1392
- } // Return app instance
1393
1378
 
1379
+ if (app.params.init) init(); // Return app instance
1394
1380
 
1395
1381
  return app || _assertThisInitialized(_this);
1382
+ } // 首次加载事件,全局只触发一次
1383
+
1384
+
1385
+ var _proto = App.prototype;
1386
+
1387
+ _proto.load = function load(param) {
1388
+ this.emit('local::load appLoad', param);
1389
+ } // 从后台切换到前台显示事件
1390
+ ;
1391
+
1392
+ _proto.show = function show(url, data) {
1393
+ this.emit('local::show appShow', url, data);
1394
+ } // 从前台显示切换到后台事件
1395
+ ;
1396
+
1397
+ _proto.hide = function hide() {
1398
+ this.emit('local::hide appHide');
1399
+ } // 卸载应用事件
1400
+ ;
1401
+
1402
+ _proto.unload = function unload() {
1403
+ this.emit('local::unload appUnload');
1396
1404
  }
1397
1405
  /**
1398
1406
  * 初始化数据
1399
1407
  */
1400
-
1401
-
1402
- var _proto = App.prototype;
1408
+ ;
1403
1409
 
1404
1410
  _proto.initData = function initData() {
1405
1411
  var app = this; // Data
@@ -1448,12 +1454,19 @@ function (_Module) {
1448
1454
  var app = this;
1449
1455
  if (app.mq.dark) app.mq.dark.removeListener(app.colorSchemeListener);
1450
1456
  if (app.mq.light) app.mq.light.removeListener(app.colorSchemeListener);
1451
- } // 初始化
1457
+ } // 初始化,包括控制 html 样式,wia app 启动时需要执行,切换app时,不需要
1452
1458
  ;
1453
1459
 
1454
1460
  _proto.init = function init() {
1455
1461
  var app = this;
1456
1462
  if (app.initialized) return app;
1463
+ $.App = App;
1464
+
1465
+ if (Device$1.ios && Device$1.webView) {
1466
+ // Strange hack required for iOS 8 webview to work on inputs
1467
+ window.addEventListener('touchstart', function () {});
1468
+ }
1469
+
1457
1470
  app.root.addClass('framework7-initializing'); // RTL attr
1458
1471
 
1459
1472
  if (app.rtl) {
@@ -1481,11 +1494,11 @@ function (_Module) {
1481
1494
 
1482
1495
  $('html').removeClass('ios md aurora').addClass(app.theme); // iOS Translucent
1483
1496
 
1484
- if (app.params.iosTranslucentBars && app.theme === 'ios' && Device.ios) {
1497
+ if (app.params.iosTranslucentBars && app.theme === 'ios' && Device$1.ios) {
1485
1498
  $('html').addClass('ios-translucent-bars');
1486
1499
  }
1487
1500
 
1488
- if (app.params.iosTranslucentModals && app.theme === 'ios' && Device.ios) {
1501
+ if (app.params.iosTranslucentModals && app.theme === 'ios' && Device$1.ios) {
1489
1502
  $('html').addClass('ios-translucent-modals');
1490
1503
  } // Init class
1491
1504
 
@@ -1495,7 +1508,8 @@ function (_Module) {
1495
1508
  });
1496
1509
  initStyle(); // Emit, init other modules
1497
1510
 
1498
- app.initialized = true;
1511
+ app.initialized = true; // 发起init 事件,模块 on 里面有 init方法的会被触发
1512
+
1499
1513
  app.emit('init');
1500
1514
  return app;
1501
1515
  } // eslint-disable-next-line
@@ -1554,53 +1568,56 @@ function (_Module) {
1554
1568
  */
1555
1569
 
1556
1570
 
1571
+ App.apps = {};
1572
+
1557
1573
  function initStyle() {
1558
1574
  var classNames = [];
1559
1575
  var html = document.querySelector('html');
1560
1576
  var metaStatusbar = document.querySelector('meta[name="apple-mobile-web-app-status-bar-style"]');
1561
1577
  if (!html) return;
1562
1578
 
1563
- if (Device.standalone && Device.ios && metaStatusbar && metaStatusbar.content === 'black-translucent') {
1579
+ if (Device$1.standalone && Device$1.ios && metaStatusbar && metaStatusbar.content === 'black-translucent') {
1564
1580
  classNames.push('device-full-viewport');
1565
1581
  } // Pixel Ratio
1566
1582
 
1567
1583
 
1568
- classNames.push("device-pixel-ratio-" + Math.floor(Device.pixelRatio)); // OS classes
1584
+ classNames.push("device-pixel-ratio-" + Math.floor(Device$1.pixelRatio)); // OS classes
1569
1585
 
1570
- if (Device.os && !Device.desktop) {
1571
- classNames.push("device-" + Device.os);
1572
- } else if (Device.desktop) {
1586
+ if (Device$1.os && !Device$1.desktop) {
1587
+ classNames.push("device-" + Device$1.os);
1588
+ } else if (Device$1.desktop) {
1573
1589
  classNames.push('device-desktop');
1574
1590
 
1575
- if (Device.os) {
1576
- classNames.push("device-" + Device.os);
1591
+ if (Device$1.os) {
1592
+ classNames.push("device-" + Device$1.os);
1577
1593
  }
1578
1594
  }
1579
1595
 
1580
- if (Device.cordova || Device.phonegap) {
1596
+ if (Device$1.cordova || Device$1.phonegap) {
1581
1597
  classNames.push('device-cordova');
1582
1598
  } // Add html classes
1583
1599
 
1584
1600
 
1585
1601
  classNames.forEach(function (className) {
1586
- html.classList.add(className);
1602
+ html.classList.add(className); // console.log({className});
1587
1603
  });
1588
- }
1604
+ } // App 类 静态方法、属性
1605
+
1589
1606
 
1590
1607
  App.ModalMethods = Modals;
1591
1608
  App.ConstructorMethods = Constructors; // 动态加载模块(base里面已经内置动态加载,这个方法应该用不上)
1592
1609
 
1593
1610
  App.loadModule = loadModule;
1594
1611
 
1595
- App.loadModules = function loadModules(modules) {
1612
+ App.loadModules = function (modules) {
1596
1613
  return Promise.all(modules.map(function (module) {
1597
1614
  return App.loadModule(module);
1598
1615
  }));
1599
1616
  }; // app 加载到 app实例的一些扩展模块
1600
1617
 
1601
1618
 
1602
- App.support = Support;
1603
- App.device = Device;
1619
+ App.support = Support$1;
1620
+ App.device = Device$1;
1604
1621
  App.utils = Utils; // 添加应用缺省模块
1605
1622
 
1606
1623
  App.use([Resize, // 控制屏幕大小
@@ -1660,9 +1677,7 @@ var _dpr = window.devicePixelRatio || window.screen.deviceXDPI / window.screen.l
1660
1677
  */
1661
1678
 
1662
1679
 
1663
- var Lazy =
1664
- /*#__PURE__*/
1665
- function () {
1680
+ var Lazy = /*#__PURE__*/function () {
1666
1681
  // 实例属性
1667
1682
  function Lazy(opt) {
1668
1683
  _opt = $.assign({}, _opts, opt);
@@ -1821,9 +1836,7 @@ function _update(root) {
1821
1836
  return this;
1822
1837
  }
1823
1838
 
1824
- var Page =
1825
- /*#__PURE__*/
1826
- function (_Event) {
1839
+ var Page = /*#__PURE__*/function (_Event) {
1827
1840
  _inheritsLoose(Page, _Event);
1828
1841
 
1829
1842
  function Page(app, name, title, style) {
@@ -1839,7 +1852,11 @@ function (_Event) {
1839
1852
  _this.style = style || "./page/" + name + ".css";
1840
1853
  _this.path = "" + name; // url 路径,不使用正则,直接查找
1841
1854
 
1842
- _this.view = null; // 页面的divDom对象,router创建实例时赋值
1855
+ _this.view = null; // 页面的div层$Dom对象,router创建实例时赋值
1856
+
1857
+ _this.el = null; // $dom
1858
+
1859
+ _this.$el = null; // $dom
1843
1860
 
1844
1861
  _this.html = ''; // 页面html文本,router创建实例时赋值
1845
1862
 
@@ -1879,15 +1896,43 @@ function (_Event) {
1879
1896
  // $.assign(this, {page, param, back});
1880
1897
  // $.assign(this.data, param);
1881
1898
  // 隐藏所有模板
1899
+ this.init();
1882
1900
  this.emit('local::ready pageReady', view, param, back);
1883
- view.qus('[name$=-tp]').hide();
1901
+ }
1902
+ /**
1903
+ * 对页面进行初始化处理,或页面内容动态变更时,对局部页面容器进行初始化
1904
+ * 具备name属性的dom节点直接赋值给页面view
1905
+ * 只挂载一个,多个同名name,最后一个起作用,因此一个页面内,name不要重复
1906
+ * 同节点多次调用不覆盖,同名不同dom节点,覆盖
1907
+ * 覆盖后,原直接节点属性的 bind 会失效,需真的新的$dom重新bind
1908
+ * @param {*} v dom 容器,默认为页面实例的view
1909
+ */
1910
+ ;
1911
+
1912
+ _proto.init = function init(v) {
1913
+ var view = this.view;
1914
+ v = v ? $(v) : view; // 页面上带name属性节点,直接作为page.view的属性,方便页面代码直接调用
1915
+
1916
+ var ns = v.qus('[name]');
1917
+ ns === null || ns === void 0 ? void 0 : ns.forEach(function (n) {
1918
+ var $n = $(n);
1919
+ var name = $n.attr('name');
1920
+ if (!view[name] || view[name].dom !== n) view[name] = $n;
1921
+ }); // 隐藏所有模板
1922
+
1923
+ v.qus('[name$=-tp]').hide(); // 防止空链接,刷新页面
1924
+
1925
+ v.qus('a[href=""]').attr('href', 'javascript:;');
1884
1926
  } // 显示已加载的页面
1885
1927
  // view:页面Dom层,param:参数
1886
1928
  ;
1887
1929
 
1888
1930
  _proto.show = function show(view, param) {
1889
- // 防止空链接,刷新页面
1890
- view.qus('a[href=""]').attr('href', 'javascript:;');
1931
+ // 隐藏所有模板
1932
+ view.qus('[name$=-tp]').hide(); // 防止空链接,刷新页面
1933
+
1934
+ view.qus('a[href=""]').attr('href', 'javascript:;'); // this.init();
1935
+
1891
1936
  if (this.reset) this.reset();
1892
1937
  this.emit('local::show pageShow', view, param);
1893
1938
  } // 回退显示已加载的页面
@@ -1895,7 +1940,9 @@ function (_Event) {
1895
1940
  ;
1896
1941
 
1897
1942
  _proto.back = function back(view, param) {
1898
- // 防止空链接,刷新页面
1943
+ // 隐藏所有模板
1944
+ view.qus('[name$=-tp]').hide(); // 防止空链接,刷新页面
1945
+
1899
1946
  view.qus('a[href=""]').attr('href', 'javascript:;');
1900
1947
  this.emit('local::back pageBack', view, param);
1901
1948
  };
@@ -1916,9 +1963,7 @@ function clearDialogsQueue() {
1916
1963
  dialog.open();
1917
1964
  }
1918
1965
 
1919
- var Modal =
1920
- /*#__PURE__*/
1921
- function (_Event) {
1966
+ var Modal = /*#__PURE__*/function (_Event) {
1922
1967
  _inheritsLoose(Modal, _Event);
1923
1968
 
1924
1969
  function Modal(app, params) {
@@ -2151,9 +2196,43 @@ function (_Event) {
2151
2196
  return Modal;
2152
2197
  }(Event);
2153
2198
 
2199
+ // replace react, use by @babel/plugin-transform-react-jsx
2200
+
2201
+ /* eslint-disable prefer-rest-params */
2202
+ function jsx(tag, props) {
2203
+ var attrs = props || {};
2204
+
2205
+ for (var _len = arguments.length, args = new Array(_len > 2 ? _len - 2 : 0), _key = 2; _key < _len; _key++) {
2206
+ args[_key - 2] = arguments[_key];
2207
+ }
2208
+
2209
+ var children = args || [];
2210
+ var attrsString = Object.keys(attrs).map(function (attr) {
2211
+ if (attr[0] === '_') {
2212
+ if (attrs[attr]) return attr.replace('_', '');
2213
+ return '';
2214
+ }
2215
+
2216
+ return attr + "=\"" + attrs[attr] + "\"";
2217
+ }).filter(function (attr) {
2218
+ return !!attr;
2219
+ }).join(' ');
2220
+
2221
+ if (['path', 'img', 'circle', 'polygon', 'line', 'input'].indexOf(tag) >= 0) {
2222
+ return ("<" + tag + " " + attrsString + " />").trim();
2223
+ }
2224
+
2225
+ var childrenContent = children.filter(function (c) {
2226
+ return !!c;
2227
+ }).map(function (c) {
2228
+ return Array.isArray(c) ? c.join('') : c;
2229
+ }).join('');
2230
+ return ("<" + tag + " " + attrsString + ">" + childrenContent + "</" + tag + ">").trim();
2231
+ }
2232
+
2154
2233
  // export {default as Device} from './device';
2155
2234
 
2156
- var Support$1 = $.support;
2157
- var Device$1 = $.device;
2235
+ var Support = $.support;
2236
+ var Device = $.device;
2158
2237
 
2159
- export { Ajax, App, Constructors, Device$1 as Device, Event, Lazy, Modal, Modals, Module, Page, Resize, SW$1 as SW, Support$1 as Support, Utils, loadModule };
2238
+ export { Ajax, App, Constructors, Device, Event, Lazy, Modal, Modals, Module, Page, Resize, SW$1 as SW, Support, Utils, jsx, loadModule };