蓝牙控制阀小程序
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

10462 lines
309 KiB

3 years ago
  1. (global["webpackJsonp"] = global["webpackJsonp"] || []).push([["common/vendor"],[
  2. /* 0 */,
  3. /* 1 */
  4. /*!************************************************************!*\
  5. !*** ./node_modules/@dcloudio/uni-mp-weixin/dist/index.js ***!
  6. \************************************************************/
  7. /*! no static exports found */
  8. /***/ (function(module, exports, __webpack_require__) {
  9. "use strict";
  10. Object.defineProperty(exports, "__esModule", { value: true });exports.createApp = createApp;exports.createComponent = createComponent;exports.createPage = createPage;exports.createSubpackageApp = createSubpackageApp;exports.default = void 0;var _vue = _interopRequireDefault(__webpack_require__(/*! vue */ 2));function _interopRequireDefault(obj) {return obj && obj.__esModule ? obj : { default: obj };}function ownKeys(object, enumerableOnly) {var keys = Object.keys(object);if (Object.getOwnPropertySymbols) {var symbols = Object.getOwnPropertySymbols(object);if (enumerableOnly) symbols = symbols.filter(function (sym) {return Object.getOwnPropertyDescriptor(object, sym).enumerable;});keys.push.apply(keys, symbols);}return keys;}function _objectSpread(target) {for (var i = 1; i < arguments.length; i++) {var source = arguments[i] != null ? arguments[i] : {};if (i % 2) {ownKeys(Object(source), true).forEach(function (key) {_defineProperty(target, key, source[key]);});} else if (Object.getOwnPropertyDescriptors) {Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));} else {ownKeys(Object(source)).forEach(function (key) {Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));});}}return target;}function _slicedToArray(arr, i) {return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest();}function _nonIterableRest() {throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");}function _iterableToArrayLimit(arr, i) {if (typeof Symbol === "undefined" || !(Symbol.iterator in Object(arr))) return;var _arr = [];var _n = true;var _d = false;var _e = undefined;try {for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) {_arr.push(_s.value);if (i && _arr.length === i) break;}} catch (err) {_d = true;_e = err;} finally {try {if (!_n && _i["return"] != null) _i["return"]();} finally {if (_d) throw _e;}}return _arr;}function _arrayWithHoles(arr) {if (Array.isArray(arr)) return arr;}function _defineProperty(obj, key, value) {if (key in obj) {Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true });} else {obj[key] = value;}return obj;}function _toConsumableArray(arr) {return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread();}function _nonIterableSpread() {throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");}function _unsupportedIterableToArray(o, minLen) {if (!o) return;if (typeof o === "string") return _arrayLikeToArray(o, minLen);var n = Object.prototype.toString.call(o).slice(8, -1);if (n === "Object" && o.constructor) n = o.constructor.name;if (n === "Map" || n === "Set") return Array.from(o);if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen);}function _iterableToArray(iter) {if (typeof Symbol !== "undefined" && Symbol.iterator in Object(iter)) return Array.from(iter);}function _arrayWithoutHoles(arr) {if (Array.isArray(arr)) return _arrayLikeToArray(arr);}function _arrayLikeToArray(arr, len) {if (len == null || len > arr.length) len = arr.length;for (var i = 0, arr2 = new Array(len); i < len; i++) {arr2[i] = arr[i];}return arr2;}
  11. var _toString = Object.prototype.toString;
  12. var hasOwnProperty = Object.prototype.hasOwnProperty;
  13. function isFn(fn) {
  14. return typeof fn === 'function';
  15. }
  16. function isStr(str) {
  17. return typeof str === 'string';
  18. }
  19. function isPlainObject(obj) {
  20. return _toString.call(obj) === '[object Object]';
  21. }
  22. function hasOwn(obj, key) {
  23. return hasOwnProperty.call(obj, key);
  24. }
  25. function noop() {}
  26. /**
  27. * Create a cached version of a pure function.
  28. */
  29. function cached(fn) {
  30. var cache = Object.create(null);
  31. return function cachedFn(str) {
  32. var hit = cache[str];
  33. return hit || (cache[str] = fn(str));
  34. };
  35. }
  36. /**
  37. * Camelize a hyphen-delimited string.
  38. */
  39. var camelizeRE = /-(\w)/g;
  40. var camelize = cached(function (str) {
  41. return str.replace(camelizeRE, function (_, c) {return c ? c.toUpperCase() : '';});
  42. });
  43. var HOOKS = [
  44. 'invoke',
  45. 'success',
  46. 'fail',
  47. 'complete',
  48. 'returnValue'];
  49. var globalInterceptors = {};
  50. var scopedInterceptors = {};
  51. function mergeHook(parentVal, childVal) {
  52. var res = childVal ?
  53. parentVal ?
  54. parentVal.concat(childVal) :
  55. Array.isArray(childVal) ?
  56. childVal : [childVal] :
  57. parentVal;
  58. return res ?
  59. dedupeHooks(res) :
  60. res;
  61. }
  62. function dedupeHooks(hooks) {
  63. var res = [];
  64. for (var i = 0; i < hooks.length; i++) {
  65. if (res.indexOf(hooks[i]) === -1) {
  66. res.push(hooks[i]);
  67. }
  68. }
  69. return res;
  70. }
  71. function removeHook(hooks, hook) {
  72. var index = hooks.indexOf(hook);
  73. if (index !== -1) {
  74. hooks.splice(index, 1);
  75. }
  76. }
  77. function mergeInterceptorHook(interceptor, option) {
  78. Object.keys(option).forEach(function (hook) {
  79. if (HOOKS.indexOf(hook) !== -1 && isFn(option[hook])) {
  80. interceptor[hook] = mergeHook(interceptor[hook], option[hook]);
  81. }
  82. });
  83. }
  84. function removeInterceptorHook(interceptor, option) {
  85. if (!interceptor || !option) {
  86. return;
  87. }
  88. Object.keys(option).forEach(function (hook) {
  89. if (HOOKS.indexOf(hook) !== -1 && isFn(option[hook])) {
  90. removeHook(interceptor[hook], option[hook]);
  91. }
  92. });
  93. }
  94. function addInterceptor(method, option) {
  95. if (typeof method === 'string' && isPlainObject(option)) {
  96. mergeInterceptorHook(scopedInterceptors[method] || (scopedInterceptors[method] = {}), option);
  97. } else if (isPlainObject(method)) {
  98. mergeInterceptorHook(globalInterceptors, method);
  99. }
  100. }
  101. function removeInterceptor(method, option) {
  102. if (typeof method === 'string') {
  103. if (isPlainObject(option)) {
  104. removeInterceptorHook(scopedInterceptors[method], option);
  105. } else {
  106. delete scopedInterceptors[method];
  107. }
  108. } else if (isPlainObject(method)) {
  109. removeInterceptorHook(globalInterceptors, method);
  110. }
  111. }
  112. function wrapperHook(hook) {
  113. return function (data) {
  114. return hook(data) || data;
  115. };
  116. }
  117. function isPromise(obj) {
  118. return !!obj && (typeof obj === 'object' || typeof obj === 'function') && typeof obj.then === 'function';
  119. }
  120. function queue(hooks, data) {
  121. var promise = false;
  122. for (var i = 0; i < hooks.length; i++) {
  123. var hook = hooks[i];
  124. if (promise) {
  125. promise = Promise.resolve(wrapperHook(hook));
  126. } else {
  127. var res = hook(data);
  128. if (isPromise(res)) {
  129. promise = Promise.resolve(res);
  130. }
  131. if (res === false) {
  132. return {
  133. then: function then() {} };
  134. }
  135. }
  136. }
  137. return promise || {
  138. then: function then(callback) {
  139. return callback(data);
  140. } };
  141. }
  142. function wrapperOptions(interceptor) {var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
  143. ['success', 'fail', 'complete'].forEach(function (name) {
  144. if (Array.isArray(interceptor[name])) {
  145. var oldCallback = options[name];
  146. options[name] = function callbackInterceptor(res) {
  147. queue(interceptor[name], res).then(function (res) {
  148. /* eslint-disable no-mixed-operators */
  149. return isFn(oldCallback) && oldCallback(res) || res;
  150. });
  151. };
  152. }
  153. });
  154. return options;
  155. }
  156. function wrapperReturnValue(method, returnValue) {
  157. var returnValueHooks = [];
  158. if (Array.isArray(globalInterceptors.returnValue)) {
  159. returnValueHooks.push.apply(returnValueHooks, _toConsumableArray(globalInterceptors.returnValue));
  160. }
  161. var interceptor = scopedInterceptors[method];
  162. if (interceptor && Array.isArray(interceptor.returnValue)) {
  163. returnValueHooks.push.apply(returnValueHooks, _toConsumableArray(interceptor.returnValue));
  164. }
  165. returnValueHooks.forEach(function (hook) {
  166. returnValue = hook(returnValue) || returnValue;
  167. });
  168. return returnValue;
  169. }
  170. function getApiInterceptorHooks(method) {
  171. var interceptor = Object.create(null);
  172. Object.keys(globalInterceptors).forEach(function (hook) {
  173. if (hook !== 'returnValue') {
  174. interceptor[hook] = globalInterceptors[hook].slice();
  175. }
  176. });
  177. var scopedInterceptor = scopedInterceptors[method];
  178. if (scopedInterceptor) {
  179. Object.keys(scopedInterceptor).forEach(function (hook) {
  180. if (hook !== 'returnValue') {
  181. interceptor[hook] = (interceptor[hook] || []).concat(scopedInterceptor[hook]);
  182. }
  183. });
  184. }
  185. return interceptor;
  186. }
  187. function invokeApi(method, api, options) {for (var _len = arguments.length, params = new Array(_len > 3 ? _len - 3 : 0), _key = 3; _key < _len; _key++) {params[_key - 3] = arguments[_key];}
  188. var interceptor = getApiInterceptorHooks(method);
  189. if (interceptor && Object.keys(interceptor).length) {
  190. if (Array.isArray(interceptor.invoke)) {
  191. var res = queue(interceptor.invoke, options);
  192. return res.then(function (options) {
  193. return api.apply(void 0, [wrapperOptions(interceptor, options)].concat(params));
  194. });
  195. } else {
  196. return api.apply(void 0, [wrapperOptions(interceptor, options)].concat(params));
  197. }
  198. }
  199. return api.apply(void 0, [options].concat(params));
  200. }
  201. var promiseInterceptor = {
  202. returnValue: function returnValue(res) {
  203. if (!isPromise(res)) {
  204. return res;
  205. }
  206. return res.then(function (res) {
  207. return res[1];
  208. }).catch(function (res) {
  209. return res[0];
  210. });
  211. } };
  212. var SYNC_API_RE =
  213. /^\$|Window$|WindowStyle$|sendNativeEvent|restoreGlobal|getCurrentSubNVue|getMenuButtonBoundingClientRect|^report|interceptors|Interceptor$|getSubNVueById|requireNativePlugin|upx2px|hideKeyboard|canIUse|^create|Sync$|Manager$|base64ToArrayBuffer|arrayBufferToBase64/;
  214. var CONTEXT_API_RE = /^create|Manager$/;
  215. // Context例外情况
  216. var CONTEXT_API_RE_EXC = ['createBLEConnection'];
  217. // 同步例外情况
  218. var ASYNC_API = ['createBLEConnection'];
  219. var CALLBACK_API_RE = /^on|^off/;
  220. function isContextApi(name) {
  221. return CONTEXT_API_RE.test(name) && CONTEXT_API_RE_EXC.indexOf(name) === -1;
  222. }
  223. function isSyncApi(name) {
  224. return SYNC_API_RE.test(name) && ASYNC_API.indexOf(name) === -1;
  225. }
  226. function isCallbackApi(name) {
  227. return CALLBACK_API_RE.test(name) && name !== 'onPush';
  228. }
  229. function handlePromise(promise) {
  230. return promise.then(function (data) {
  231. return [null, data];
  232. }).
  233. catch(function (err) {return [err];});
  234. }
  235. function shouldPromise(name) {
  236. if (
  237. isContextApi(name) ||
  238. isSyncApi(name) ||
  239. isCallbackApi(name))
  240. {
  241. return false;
  242. }
  243. return true;
  244. }
  245. /* eslint-disable no-extend-native */
  246. if (!Promise.prototype.finally) {
  247. Promise.prototype.finally = function (callback) {
  248. var promise = this.constructor;
  249. return this.then(
  250. function (value) {return promise.resolve(callback()).then(function () {return value;});},
  251. function (reason) {return promise.resolve(callback()).then(function () {
  252. throw reason;
  253. });});
  254. };
  255. }
  256. function promisify(name, api) {
  257. if (!shouldPromise(name)) {
  258. return api;
  259. }
  260. return function promiseApi() {var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};for (var _len2 = arguments.length, params = new Array(_len2 > 1 ? _len2 - 1 : 0), _key2 = 1; _key2 < _len2; _key2++) {params[_key2 - 1] = arguments[_key2];}
  261. if (isFn(options.success) || isFn(options.fail) || isFn(options.complete)) {
  262. return wrapperReturnValue(name, invokeApi.apply(void 0, [name, api, options].concat(params)));
  263. }
  264. return wrapperReturnValue(name, handlePromise(new Promise(function (resolve, reject) {
  265. invokeApi.apply(void 0, [name, api, Object.assign({}, options, {
  266. success: resolve,
  267. fail: reject })].concat(
  268. params));
  269. })));
  270. };
  271. }
  272. var EPS = 1e-4;
  273. var BASE_DEVICE_WIDTH = 750;
  274. var isIOS = false;
  275. var deviceWidth = 0;
  276. var deviceDPR = 0;
  277. function checkDeviceWidth() {var _wx$getSystemInfoSync =
  278. wx.getSystemInfoSync(),platform = _wx$getSystemInfoSync.platform,pixelRatio = _wx$getSystemInfoSync.pixelRatio,windowWidth = _wx$getSystemInfoSync.windowWidth; // uni=>wx runtime 编译目标是 uni 对象,内部不允许直接使用 uni
  279. deviceWidth = windowWidth;
  280. deviceDPR = pixelRatio;
  281. isIOS = platform === 'ios';
  282. }
  283. function upx2px(number, newDeviceWidth) {
  284. if (deviceWidth === 0) {
  285. checkDeviceWidth();
  286. }
  287. number = Number(number);
  288. if (number === 0) {
  289. return 0;
  290. }
  291. var result = number / BASE_DEVICE_WIDTH * (newDeviceWidth || deviceWidth);
  292. if (result < 0) {
  293. result = -result;
  294. }
  295. result = Math.floor(result + EPS);
  296. if (result === 0) {
  297. if (deviceDPR === 1 || !isIOS) {
  298. result = 1;
  299. } else {
  300. result = 0.5;
  301. }
  302. }
  303. return number < 0 ? -result : result;
  304. }
  305. var interceptors = {
  306. promiseInterceptor: promiseInterceptor };
  307. var baseApi = /*#__PURE__*/Object.freeze({
  308. __proto__: null,
  309. upx2px: upx2px,
  310. addInterceptor: addInterceptor,
  311. removeInterceptor: removeInterceptor,
  312. interceptors: interceptors });
  313. function findExistsPageIndex(url) {
  314. var pages = getCurrentPages();
  315. var len = pages.length;
  316. while (len--) {
  317. var page = pages[len];
  318. if (page.$page && page.$page.fullPath === url) {
  319. return len;
  320. }
  321. }
  322. return -1;
  323. }
  324. var redirectTo = {
  325. name: function name(fromArgs) {
  326. if (fromArgs.exists === 'back' && fromArgs.delta) {
  327. return 'navigateBack';
  328. }
  329. return 'redirectTo';
  330. },
  331. args: function args(fromArgs) {
  332. if (fromArgs.exists === 'back' && fromArgs.url) {
  333. var existsPageIndex = findExistsPageIndex(fromArgs.url);
  334. if (existsPageIndex !== -1) {
  335. var delta = getCurrentPages().length - 1 - existsPageIndex;
  336. if (delta > 0) {
  337. fromArgs.delta = delta;
  338. }
  339. }
  340. }
  341. } };
  342. var previewImage = {
  343. args: function args(fromArgs) {
  344. var currentIndex = parseInt(fromArgs.current);
  345. if (isNaN(currentIndex)) {
  346. return;
  347. }
  348. var urls = fromArgs.urls;
  349. if (!Array.isArray(urls)) {
  350. return;
  351. }
  352. var len = urls.length;
  353. if (!len) {
  354. return;
  355. }
  356. if (currentIndex < 0) {
  357. currentIndex = 0;
  358. } else if (currentIndex >= len) {
  359. currentIndex = len - 1;
  360. }
  361. if (currentIndex > 0) {
  362. fromArgs.current = urls[currentIndex];
  363. fromArgs.urls = urls.filter(
  364. function (item, index) {return index < currentIndex ? item !== urls[currentIndex] : true;});
  365. } else {
  366. fromArgs.current = urls[0];
  367. }
  368. return {
  369. indicator: false,
  370. loop: false };
  371. } };
  372. var UUID_KEY = '__DC_STAT_UUID';
  373. var deviceId;
  374. function addUuid(result) {
  375. deviceId = deviceId || wx.getStorageSync(UUID_KEY);
  376. if (!deviceId) {
  377. deviceId = Date.now() + '' + Math.floor(Math.random() * 1e7);
  378. wx.setStorage({
  379. key: UUID_KEY,
  380. data: deviceId });
  381. }
  382. result.deviceId = deviceId;
  383. }
  384. function addSafeAreaInsets(result) {
  385. if (result.safeArea) {
  386. var safeArea = result.safeArea;
  387. result.safeAreaInsets = {
  388. top: safeArea.top,
  389. left: safeArea.left,
  390. right: result.windowWidth - safeArea.right,
  391. bottom: result.windowHeight - safeArea.bottom };
  392. }
  393. }
  394. var getSystemInfo = {
  395. returnValue: function returnValue(result) {
  396. addUuid(result);
  397. addSafeAreaInsets(result);
  398. } };
  399. // import navigateTo from 'uni-helpers/navigate-to'
  400. var protocols = {
  401. redirectTo: redirectTo,
  402. // navigateTo, // 由于在微信开发者工具的页面参数,会显示__id__参数,因此暂时关闭mp-weixin对于navigateTo的AOP
  403. previewImage: previewImage,
  404. getSystemInfo: getSystemInfo,
  405. getSystemInfoSync: getSystemInfo };
  406. var todos = [
  407. 'vibrate',
  408. 'preloadPage',
  409. 'unPreloadPage',
  410. 'loadSubPackage'];
  411. var canIUses = [];
  412. var CALLBACKS = ['success', 'fail', 'cancel', 'complete'];
  413. function processCallback(methodName, method, returnValue) {
  414. return function (res) {
  415. return method(processReturnValue(methodName, res, returnValue));
  416. };
  417. }
  418. function processArgs(methodName, fromArgs) {var argsOption = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};var returnValue = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {};var keepFromArgs = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : false;
  419. if (isPlainObject(fromArgs)) {// 一般 api 的参数解析
  420. var toArgs = keepFromArgs === true ? fromArgs : {}; // returnValue 为 false 时,说明是格式化返回值,直接在返回值对象上修改赋值
  421. if (isFn(argsOption)) {
  422. argsOption = argsOption(fromArgs, toArgs) || {};
  423. }
  424. for (var key in fromArgs) {
  425. if (hasOwn(argsOption, key)) {
  426. var keyOption = argsOption[key];
  427. if (isFn(keyOption)) {
  428. keyOption = keyOption(fromArgs[key], fromArgs, toArgs);
  429. }
  430. if (!keyOption) {// 不支持的参数
  431. console.warn("\u5FAE\u4FE1\u5C0F\u7A0B\u5E8F ".concat(methodName, "\u6682\u4E0D\u652F\u6301").concat(key));
  432. } else if (isStr(keyOption)) {// 重写参数 key
  433. toArgs[keyOption] = fromArgs[key];
  434. } else if (isPlainObject(keyOption)) {// {name:newName,value:value}可重新指定参数 key:value
  435. toArgs[keyOption.name ? keyOption.name : key] = keyOption.value;
  436. }
  437. } else if (CALLBACKS.indexOf(key) !== -1) {
  438. if (isFn(fromArgs[key])) {
  439. toArgs[key] = processCallback(methodName, fromArgs[key], returnValue);
  440. }
  441. } else {
  442. if (!keepFromArgs) {
  443. toArgs[key] = fromArgs[key];
  444. }
  445. }
  446. }
  447. return toArgs;
  448. } else if (isFn(fromArgs)) {
  449. fromArgs = processCallback(methodName, fromArgs, returnValue);
  450. }
  451. return fromArgs;
  452. }
  453. function processReturnValue(methodName, res, returnValue) {var keepReturnValue = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : false;
  454. if (isFn(protocols.returnValue)) {// 处理通用 returnValue
  455. res = protocols.returnValue(methodName, res);
  456. }
  457. return processArgs(methodName, res, returnValue, {}, keepReturnValue);
  458. }
  459. function wrapper(methodName, method) {
  460. if (hasOwn(protocols, methodName)) {
  461. var protocol = protocols[methodName];
  462. if (!protocol) {// 暂不支持的 api
  463. return function () {
  464. console.error("\u5FAE\u4FE1\u5C0F\u7A0B\u5E8F \u6682\u4E0D\u652F\u6301".concat(methodName));
  465. };
  466. }
  467. return function (arg1, arg2) {// 目前 api 最多两个参数
  468. var options = protocol;
  469. if (isFn(protocol)) {
  470. options = protocol(arg1);
  471. }
  472. arg1 = processArgs(methodName, arg1, options.args, options.returnValue);
  473. var args = [arg1];
  474. if (typeof arg2 !== 'undefined') {
  475. args.push(arg2);
  476. }
  477. if (isFn(options.name)) {
  478. methodName = options.name(arg1);
  479. } else if (isStr(options.name)) {
  480. methodName = options.name;
  481. }
  482. var returnValue = wx[methodName].apply(wx, args);
  483. if (isSyncApi(methodName)) {// 同步 api
  484. return processReturnValue(methodName, returnValue, options.returnValue, isContextApi(methodName));
  485. }
  486. return returnValue;
  487. };
  488. }
  489. return method;
  490. }
  491. var todoApis = Object.create(null);
  492. var TODOS = [
  493. 'onTabBarMidButtonTap',
  494. 'subscribePush',
  495. 'unsubscribePush',
  496. 'onPush',
  497. 'offPush',
  498. 'share'];
  499. function createTodoApi(name) {
  500. return function todoApi(_ref)
  501. {var fail = _ref.fail,complete = _ref.complete;
  502. var res = {
  503. errMsg: "".concat(name, ":fail:\u6682\u4E0D\u652F\u6301 ").concat(name, " \u65B9\u6CD5") };
  504. isFn(fail) && fail(res);
  505. isFn(complete) && complete(res);
  506. };
  507. }
  508. TODOS.forEach(function (name) {
  509. todoApis[name] = createTodoApi(name);
  510. });
  511. var providers = {
  512. oauth: ['weixin'],
  513. share: ['weixin'],
  514. payment: ['wxpay'],
  515. push: ['weixin'] };
  516. function getProvider(_ref2)
  517. {var service = _ref2.service,success = _ref2.success,fail = _ref2.fail,complete = _ref2.complete;
  518. var res = false;
  519. if (providers[service]) {
  520. res = {
  521. errMsg: 'getProvider:ok',
  522. service: service,
  523. provider: providers[service] };
  524. isFn(success) && success(res);
  525. } else {
  526. res = {
  527. errMsg: 'getProvider:fail:服务[' + service + ']不存在' };
  528. isFn(fail) && fail(res);
  529. }
  530. isFn(complete) && complete(res);
  531. }
  532. var extraApi = /*#__PURE__*/Object.freeze({
  533. __proto__: null,
  534. getProvider: getProvider });
  535. var getEmitter = function () {
  536. var Emitter;
  537. return function getUniEmitter() {
  538. if (!Emitter) {
  539. Emitter = new _vue.default();
  540. }
  541. return Emitter;
  542. };
  543. }();
  544. function apply(ctx, method, args) {
  545. return ctx[method].apply(ctx, args);
  546. }
  547. function $on() {
  548. return apply(getEmitter(), '$on', Array.prototype.slice.call(arguments));
  549. }
  550. function $off() {
  551. return apply(getEmitter(), '$off', Array.prototype.slice.call(arguments));
  552. }
  553. function $once() {
  554. return apply(getEmitter(), '$once', Array.prototype.slice.call(arguments));
  555. }
  556. function $emit() {
  557. return apply(getEmitter(), '$emit', Array.prototype.slice.call(arguments));
  558. }
  559. var eventApi = /*#__PURE__*/Object.freeze({
  560. __proto__: null,
  561. $on: $on,
  562. $off: $off,
  563. $once: $once,
  564. $emit: $emit });
  565. var api = /*#__PURE__*/Object.freeze({
  566. __proto__: null });
  567. var MPPage = Page;
  568. var MPComponent = Component;
  569. var customizeRE = /:/g;
  570. var customize = cached(function (str) {
  571. return camelize(str.replace(customizeRE, '-'));
  572. });
  573. function initTriggerEvent(mpInstance) {
  574. {
  575. if (!wx.canIUse('nextTick')) {
  576. return;
  577. }
  578. }
  579. var oldTriggerEvent = mpInstance.triggerEvent;
  580. mpInstance.triggerEvent = function (event) {for (var _len3 = arguments.length, args = new Array(_len3 > 1 ? _len3 - 1 : 0), _key3 = 1; _key3 < _len3; _key3++) {args[_key3 - 1] = arguments[_key3];}
  581. return oldTriggerEvent.apply(mpInstance, [customize(event)].concat(args));
  582. };
  583. }
  584. function initHook(name, options) {
  585. var oldHook = options[name];
  586. if (!oldHook) {
  587. options[name] = function () {
  588. initTriggerEvent(this);
  589. };
  590. } else {
  591. options[name] = function () {
  592. initTriggerEvent(this);for (var _len4 = arguments.length, args = new Array(_len4), _key4 = 0; _key4 < _len4; _key4++) {args[_key4] = arguments[_key4];}
  593. return oldHook.apply(this, args);
  594. };
  595. }
  596. }
  597. if (!MPPage.__$wrappered) {
  598. MPPage.__$wrappered = true;
  599. Page = function Page() {var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
  600. initHook('onLoad', options);
  601. return MPPage(options);
  602. };
  603. Page.after = MPPage.after;
  604. Component = function Component() {var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
  605. initHook('created', options);
  606. return MPComponent(options);
  607. };
  608. }
  609. var PAGE_EVENT_HOOKS = [
  610. 'onPullDownRefresh',
  611. 'onReachBottom',
  612. 'onAddToFavorites',
  613. 'onShareTimeline',
  614. 'onShareAppMessage',
  615. 'onPageScroll',
  616. 'onResize',
  617. 'onTabItemTap'];
  618. function initMocks(vm, mocks) {
  619. var mpInstance = vm.$mp[vm.mpType];
  620. mocks.forEach(function (mock) {
  621. if (hasOwn(mpInstance, mock)) {
  622. vm[mock] = mpInstance[mock];
  623. }
  624. });
  625. }
  626. function hasHook(hook, vueOptions) {
  627. if (!vueOptions) {
  628. return true;
  629. }
  630. if (_vue.default.options && Array.isArray(_vue.default.options[hook])) {
  631. return true;
  632. }
  633. vueOptions = vueOptions.default || vueOptions;
  634. if (isFn(vueOptions)) {
  635. if (isFn(vueOptions.extendOptions[hook])) {
  636. return true;
  637. }
  638. if (vueOptions.super &&
  639. vueOptions.super.options &&
  640. Array.isArray(vueOptions.super.options[hook])) {
  641. return true;
  642. }
  643. return false;
  644. }
  645. if (isFn(vueOptions[hook])) {
  646. return true;
  647. }
  648. var mixins = vueOptions.mixins;
  649. if (Array.isArray(mixins)) {
  650. return !!mixins.find(function (mixin) {return hasHook(hook, mixin);});
  651. }
  652. }
  653. function initHooks(mpOptions, hooks, vueOptions) {
  654. hooks.forEach(function (hook) {
  655. if (hasHook(hook, vueOptions)) {
  656. mpOptions[hook] = function (args) {
  657. return this.$vm && this.$vm.__call_hook(hook, args);
  658. };
  659. }
  660. });
  661. }
  662. function initVueComponent(Vue, vueOptions) {
  663. vueOptions = vueOptions.default || vueOptions;
  664. var VueComponent;
  665. if (isFn(vueOptions)) {
  666. VueComponent = vueOptions;
  667. } else {
  668. VueComponent = Vue.extend(vueOptions);
  669. }
  670. vueOptions = VueComponent.options;
  671. return [VueComponent, vueOptions];
  672. }
  673. function initSlots(vm, vueSlots) {
  674. if (Array.isArray(vueSlots) && vueSlots.length) {
  675. var $slots = Object.create(null);
  676. vueSlots.forEach(function (slotName) {
  677. $slots[slotName] = true;
  678. });
  679. vm.$scopedSlots = vm.$slots = $slots;
  680. }
  681. }
  682. function initVueIds(vueIds, mpInstance) {
  683. vueIds = (vueIds || '').split(',');
  684. var len = vueIds.length;
  685. if (len === 1) {
  686. mpInstance._$vueId = vueIds[0];
  687. } else if (len === 2) {
  688. mpInstance._$vueId = vueIds[0];
  689. mpInstance._$vuePid = vueIds[1];
  690. }
  691. }
  692. function initData(vueOptions, context) {
  693. var data = vueOptions.data || {};
  694. var methods = vueOptions.methods || {};
  695. if (typeof data === 'function') {
  696. try {
  697. data = data.call(context); // 支持 Vue.prototype 上挂的数据
  698. } catch (e) {
  699. if (Object({"VUE_APP_NAME":"BLEApp","VUE_APP_PLATFORM":"mp-weixin","NODE_ENV":"development","BASE_URL":"/"}).VUE_APP_DEBUG) {
  700. console.warn('根据 Vue 的 data 函数初始化小程序 data 失败,请尽量确保 data 函数中不访问 vm 对象,否则可能影响首次数据渲染速度。', data);
  701. }
  702. }
  703. } else {
  704. try {
  705. // 对 data 格式化
  706. data = JSON.parse(JSON.stringify(data));
  707. } catch (e) {}
  708. }
  709. if (!isPlainObject(data)) {
  710. data = {};
  711. }
  712. Object.keys(methods).forEach(function (methodName) {
  713. if (context.__lifecycle_hooks__.indexOf(methodName) === -1 && !hasOwn(data, methodName)) {
  714. data[methodName] = methods[methodName];
  715. }
  716. });
  717. return data;
  718. }
  719. var PROP_TYPES = [String, Number, Boolean, Object, Array, null];
  720. function createObserver(name) {
  721. return function observer(newVal, oldVal) {
  722. if (this.$vm) {
  723. this.$vm[name] = newVal; // 为了触发其他非 render watcher
  724. }
  725. };
  726. }
  727. function initBehaviors(vueOptions, initBehavior) {
  728. var vueBehaviors = vueOptions.behaviors;
  729. var vueExtends = vueOptions.extends;
  730. var vueMixins = vueOptions.mixins;
  731. var vueProps = vueOptions.props;
  732. if (!vueProps) {
  733. vueOptions.props = vueProps = [];
  734. }
  735. var behaviors = [];
  736. if (Array.isArray(vueBehaviors)) {
  737. vueBehaviors.forEach(function (behavior) {
  738. behaviors.push(behavior.replace('uni://', "wx".concat("://")));
  739. if (behavior === 'uni://form-field') {
  740. if (Array.isArray(vueProps)) {
  741. vueProps.push('name');
  742. vueProps.push('value');
  743. } else {
  744. vueProps.name = {
  745. type: String,
  746. default: '' };
  747. vueProps.value = {
  748. type: [String, Number, Boolean, Array, Object, Date],
  749. default: '' };
  750. }
  751. }
  752. });
  753. }
  754. if (isPlainObject(vueExtends) && vueExtends.props) {
  755. behaviors.push(
  756. initBehavior({
  757. properties: initProperties(vueExtends.props, true) }));
  758. }
  759. if (Array.isArray(vueMixins)) {
  760. vueMixins.forEach(function (vueMixin) {
  761. if (isPlainObject(vueMixin) && vueMixin.props) {
  762. behaviors.push(
  763. initBehavior({
  764. properties: initProperties(vueMixin.props, true) }));
  765. }
  766. });
  767. }
  768. return behaviors;
  769. }
  770. function parsePropType(key, type, defaultValue, file) {
  771. // [String]=>String
  772. if (Array.isArray(type) && type.length === 1) {
  773. return type[0];
  774. }
  775. return type;
  776. }
  777. function initProperties(props) {var isBehavior = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;var file = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : '';
  778. var properties = {};
  779. if (!isBehavior) {
  780. properties.vueId = {
  781. type: String,
  782. value: '' };
  783. // 用于字节跳动小程序模拟抽象节点
  784. properties.generic = {
  785. type: Object,
  786. value: null };
  787. properties.vueSlots = { // 小程序不能直接定义 $slots 的 props,所以通过 vueSlots 转换到 $slots
  788. type: null,
  789. value: [],
  790. observer: function observer(newVal, oldVal) {
  791. var $slots = Object.create(null);
  792. newVal.forEach(function (slotName) {
  793. $slots[slotName] = true;
  794. });
  795. this.setData({
  796. $slots: $slots });
  797. } };
  798. }
  799. if (Array.isArray(props)) {// ['title']
  800. props.forEach(function (key) {
  801. properties[key] = {
  802. type: null,
  803. observer: createObserver(key) };
  804. });
  805. } else if (isPlainObject(props)) {// {title:{type:String,default:''},content:String}
  806. Object.keys(props).forEach(function (key) {
  807. var opts = props[key];
  808. if (isPlainObject(opts)) {// title:{type:String,default:''}
  809. var value = opts.default;
  810. if (isFn(value)) {
  811. value = value();
  812. }
  813. opts.type = parsePropType(key, opts.type);
  814. properties[key] = {
  815. type: PROP_TYPES.indexOf(opts.type) !== -1 ? opts.type : null,
  816. value: value,
  817. observer: createObserver(key) };
  818. } else {// content:String
  819. var type = parsePropType(key, opts);
  820. properties[key] = {
  821. type: PROP_TYPES.indexOf(type) !== -1 ? type : null,
  822. observer: createObserver(key) };
  823. }
  824. });
  825. }
  826. return properties;
  827. }
  828. function wrapper$1(event) {
  829. // TODO 又得兼容 mpvue 的 mp 对象
  830. try {
  831. event.mp = JSON.parse(JSON.stringify(event));
  832. } catch (e) {}
  833. event.stopPropagation = noop;
  834. event.preventDefault = noop;
  835. event.target = event.target || {};
  836. if (!hasOwn(event, 'detail')) {
  837. event.detail = {};
  838. }
  839. if (hasOwn(event, 'markerId')) {
  840. event.detail = typeof event.detail === 'object' ? event.detail : {};
  841. event.detail.markerId = event.markerId;
  842. }
  843. if (isPlainObject(event.detail)) {
  844. event.target = Object.assign({}, event.target, event.detail);
  845. }
  846. return event;
  847. }
  848. function getExtraValue(vm, dataPathsArray) {
  849. var context = vm;
  850. dataPathsArray.forEach(function (dataPathArray) {
  851. var dataPath = dataPathArray[0];
  852. var value = dataPathArray[2];
  853. if (dataPath || typeof value !== 'undefined') {// ['','',index,'disable']
  854. var propPath = dataPathArray[1];
  855. var valuePath = dataPathArray[3];
  856. var vFor;
  857. if (Number.isInteger(dataPath)) {
  858. vFor = dataPath;
  859. } else if (!dataPath) {
  860. vFor = context;
  861. } else if (typeof dataPath === 'string' && dataPath) {
  862. if (dataPath.indexOf('#s#') === 0) {
  863. vFor = dataPath.substr(3);
  864. } else {
  865. vFor = vm.__get_value(dataPath, context);
  866. }
  867. }
  868. if (Number.isInteger(vFor)) {
  869. context = value;
  870. } else if (!propPath) {
  871. context = vFor[value];
  872. } else {
  873. if (Array.isArray(vFor)) {
  874. context = vFor.find(function (vForItem) {
  875. return vm.__get_value(propPath, vForItem) === value;
  876. });
  877. } else if (isPlainObject(vFor)) {
  878. context = Object.keys(vFor).find(function (vForKey) {
  879. return vm.__get_value(propPath, vFor[vForKey]) === value;
  880. });
  881. } else {
  882. console.error('v-for 暂不支持循环数据:', vFor);
  883. }
  884. }
  885. if (valuePath) {
  886. context = vm.__get_value(valuePath, context);
  887. }
  888. }
  889. });
  890. return context;
  891. }
  892. function processEventExtra(vm, extra, event) {
  893. var extraObj = {};
  894. if (Array.isArray(extra) && extra.length) {
  895. /**
  896. *[
  897. * ['data.items', 'data.id', item.data.id],
  898. * ['metas', 'id', meta.id]
  899. *],
  900. *[
  901. * ['data.items', 'data.id', item.data.id],
  902. * ['metas', 'id', meta.id]
  903. *],
  904. *'test'
  905. */
  906. extra.forEach(function (dataPath, index) {
  907. if (typeof dataPath === 'string') {
  908. if (!dataPath) {// model,prop.sync
  909. extraObj['$' + index] = vm;
  910. } else {
  911. if (dataPath === '$event') {// $event
  912. extraObj['$' + index] = event;
  913. } else if (dataPath === 'arguments') {
  914. if (event.detail && event.detail.__args__) {
  915. extraObj['$' + index] = event.detail.__args__;
  916. } else {
  917. extraObj['$' + index] = [event];
  918. }
  919. } else if (dataPath.indexOf('$event.') === 0) {// $event.target.value
  920. extraObj['$' + index] = vm.__get_value(dataPath.replace('$event.', ''), event);
  921. } else {
  922. extraObj['$' + index] = vm.__get_value(dataPath);
  923. }
  924. }
  925. } else {
  926. extraObj['$' + index] = getExtraValue(vm, dataPath);
  927. }
  928. });
  929. }
  930. return extraObj;
  931. }
  932. function getObjByArray(arr) {
  933. var obj = {};
  934. for (var i = 1; i < arr.length; i++) {
  935. var element = arr[i];
  936. obj[element[0]] = element[1];
  937. }
  938. return obj;
  939. }
  940. function processEventArgs(vm, event) {var args = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : [];var extra = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : [];var isCustom = arguments.length > 4 ? arguments[4] : undefined;var methodName = arguments.length > 5 ? arguments[5] : undefined;
  941. var isCustomMPEvent = false; // wxcomponent 组件,传递原始 event 对象
  942. if (isCustom) {// 自定义事件
  943. isCustomMPEvent = event.currentTarget &&
  944. event.currentTarget.dataset &&
  945. event.currentTarget.dataset.comType === 'wx';
  946. if (!args.length) {// 无参数,直接传入 event 或 detail 数组
  947. if (isCustomMPEvent) {
  948. return [event];
  949. }
  950. return event.detail.__args__ || event.detail;
  951. }
  952. }
  953. var extraObj = processEventExtra(vm, extra, event);
  954. var ret = [];
  955. args.forEach(function (arg) {
  956. if (arg === '$event') {
  957. if (methodName === '__set_model' && !isCustom) {// input v-model value
  958. ret.push(event.target.value);
  959. } else {
  960. if (isCustom && !isCustomMPEvent) {
  961. ret.push(event.detail.__args__[0]);
  962. } else {// wxcomponent 组件或内置组件
  963. ret.push(event);
  964. }
  965. }
  966. } else {
  967. if (Array.isArray(arg) && arg[0] === 'o') {
  968. ret.push(getObjByArray(arg));
  969. } else if (typeof arg === 'string' && hasOwn(extraObj, arg)) {
  970. ret.push(extraObj[arg]);
  971. } else {
  972. ret.push(arg);
  973. }
  974. }
  975. });
  976. return ret;
  977. }
  978. var ONCE = '~';
  979. var CUSTOM = '^';
  980. function isMatchEventType(eventType, optType) {
  981. return eventType === optType ||
  982. optType === 'regionchange' && (
  983. eventType === 'begin' ||
  984. eventType === 'end');
  985. }
  986. function getContextVm(vm) {
  987. var $parent = vm.$parent;
  988. // 父组件是 scoped slots 或者其他自定义组件时继续查找
  989. while ($parent && $parent.$parent && ($parent.$options.generic || $parent.$parent.$options.generic || $parent.$scope._$vuePid)) {
  990. $parent = $parent.$parent;
  991. }
  992. return $parent && $parent.$parent;
  993. }
  994. function handleEvent(event) {var _this = this;
  995. event = wrapper$1(event);
  996. // [['tap',[['handle',[1,2,a]],['handle1',[1,2,a]]]]]
  997. var dataset = (event.currentTarget || event.target).dataset;
  998. if (!dataset) {
  999. return console.warn('事件信息不存在');
  1000. }
  1001. var eventOpts = dataset.eventOpts || dataset['event-opts']; // 支付宝 web-view 组件 dataset 非驼峰
  1002. if (!eventOpts) {
  1003. return console.warn('事件信息不存在');
  1004. }
  1005. // [['handle',[1,2,a]],['handle1',[1,2,a]]]
  1006. var eventType = event.type;
  1007. var ret = [];
  1008. eventOpts.forEach(function (eventOpt) {
  1009. var type = eventOpt[0];
  1010. var eventsArray = eventOpt[1];
  1011. var isCustom = type.charAt(0) === CUSTOM;
  1012. type = isCustom ? type.slice(1) : type;
  1013. var isOnce = type.charAt(0) === ONCE;
  1014. type = isOnce ? type.slice(1) : type;
  1015. if (eventsArray && isMatchEventType(eventType, type)) {
  1016. eventsArray.forEach(function (eventArray) {
  1017. var methodName = eventArray[0];
  1018. if (methodName) {
  1019. var handlerCtx = _this.$vm;
  1020. if (handlerCtx.$options.generic) {// mp-weixin,mp-toutiao 抽象节点模拟 scoped slots
  1021. handlerCtx = getContextVm(handlerCtx) || handlerCtx;
  1022. }
  1023. if (methodName === '$emit') {
  1024. handlerCtx.$emit.apply(handlerCtx,
  1025. processEventArgs(
  1026. _this.$vm,
  1027. event,
  1028. eventArray[1],
  1029. eventArray[2],
  1030. isCustom,
  1031. methodName));
  1032. return;
  1033. }
  1034. var handler = handlerCtx[methodName];
  1035. if (!isFn(handler)) {
  1036. throw new Error(" _vm.".concat(methodName, " is not a function"));
  1037. }
  1038. if (isOnce) {
  1039. if (handler.once) {
  1040. return;
  1041. }
  1042. handler.once = true;
  1043. }
  1044. var params = processEventArgs(
  1045. _this.$vm,
  1046. event,
  1047. eventArray[1],
  1048. eventArray[2],
  1049. isCustom,
  1050. methodName);
  1051. params = Array.isArray(params) ? params : [];
  1052. // 参数尾部增加原始事件对象用于复杂表达式内获取额外数据
  1053. if (/=\s*\S+\.eventParams\s*\|\|\s*\S+\[['"]event-params['"]\]/.test(handler.toString())) {
  1054. // eslint-disable-next-line no-sparse-arrays
  1055. params = params.concat([,,,,,,,,,, event]);
  1056. }
  1057. ret.push(handler.apply(handlerCtx, params));
  1058. }
  1059. });
  1060. }
  1061. });
  1062. if (
  1063. eventType === 'input' &&
  1064. ret.length === 1 &&
  1065. typeof ret[0] !== 'undefined')
  1066. {
  1067. return ret[0];
  1068. }
  1069. }
  1070. var eventChannels = {};
  1071. var eventChannelStack = [];
  1072. function getEventChannel(id) {
  1073. if (id) {
  1074. var eventChannel = eventChannels[id];
  1075. delete eventChannels[id];
  1076. return eventChannel;
  1077. }
  1078. return eventChannelStack.shift();
  1079. }
  1080. var hooks = [
  1081. 'onShow',
  1082. 'onHide',
  1083. 'onError',
  1084. 'onPageNotFound',
  1085. 'onThemeChange',
  1086. 'onUnhandledRejection'];
  1087. function initEventChannel() {
  1088. _vue.default.prototype.getOpenerEventChannel = function () {
  1089. // 微信小程序使用自身getOpenerEventChannel
  1090. {
  1091. return this.$scope.getOpenerEventChannel();
  1092. }
  1093. };
  1094. var callHook = _vue.default.prototype.__call_hook;
  1095. _vue.default.prototype.__call_hook = function (hook, args) {
  1096. if (hook === 'onLoad' && args && args.__id__) {
  1097. this.__eventChannel__ = getEventChannel(args.__id__);
  1098. delete args.__id__;
  1099. }
  1100. return callHook.call(this, hook, args);
  1101. };
  1102. }
  1103. function parseBaseApp(vm, _ref3)
  1104. {var mocks = _ref3.mocks,initRefs = _ref3.initRefs;
  1105. initEventChannel();
  1106. if (vm.$options.store) {
  1107. _vue.default.prototype.$store = vm.$options.store;
  1108. }
  1109. _vue.default.prototype.mpHost = "mp-weixin";
  1110. _vue.default.mixin({
  1111. beforeCreate: function beforeCreate() {
  1112. if (!this.$options.mpType) {
  1113. return;
  1114. }
  1115. this.mpType = this.$options.mpType;
  1116. this.$mp = _defineProperty({
  1117. data: {} },
  1118. this.mpType, this.$options.mpInstance);
  1119. this.$scope = this.$options.mpInstance;
  1120. delete this.$options.mpType;
  1121. delete this.$options.mpInstance;
  1122. if (this.mpType !== 'app') {
  1123. initRefs(this);
  1124. initMocks(this, mocks);
  1125. }
  1126. } });
  1127. var appOptions = {
  1128. onLaunch: function onLaunch(args) {
  1129. if (this.$vm) {// 已经初始化过了,主要是为了百度,百度 onShow 在 onLaunch 之前
  1130. return;
  1131. }
  1132. {
  1133. if (!wx.canIUse('nextTick')) {// 事实 上2.2.3 即可,简单使用 2.3.0 的 nextTick 判断
  1134. console.error('当前微信基础库版本过低,请将 微信开发者工具-详情-项目设置-调试基础库版本 更换为`2.3.0`以上');
  1135. }
  1136. }
  1137. this.$vm = vm;
  1138. this.$vm.$mp = {
  1139. app: this };
  1140. this.$vm.$scope = this;
  1141. // vm 上也挂载 globalData
  1142. this.$vm.globalData = this.globalData;
  1143. this.$vm._isMounted = true;
  1144. this.$vm.__call_hook('mounted', args);
  1145. this.$vm.__call_hook('onLaunch', args);
  1146. } };
  1147. // 兼容旧版本 globalData
  1148. appOptions.globalData = vm.$options.globalData || {};
  1149. // 将 methods 中的方法挂在 getApp() 中
  1150. var methods = vm.$options.methods;
  1151. if (methods) {
  1152. Object.keys(methods).forEach(function (name) {
  1153. appOptions[name] = methods[name];
  1154. });
  1155. }
  1156. initHooks(appOptions, hooks);
  1157. return appOptions;
  1158. }
  1159. var mocks = ['__route__', '__wxExparserNodeId__', '__wxWebviewId__'];
  1160. function findVmByVueId(vm, vuePid) {
  1161. var $children = vm.$children;
  1162. // 优先查找直属(反向查找:https://github.com/dcloudio/uni-app/issues/1200)
  1163. for (var i = $children.length - 1; i >= 0; i--) {
  1164. var childVm = $children[i];
  1165. if (childVm.$scope._$vueId === vuePid) {
  1166. return childVm;
  1167. }
  1168. }
  1169. // 反向递归查找
  1170. var parentVm;
  1171. for (var _i = $children.length - 1; _i >= 0; _i--) {
  1172. parentVm = findVmByVueId($children[_i], vuePid);
  1173. if (parentVm) {
  1174. return parentVm;
  1175. }
  1176. }
  1177. }
  1178. function initBehavior(options) {
  1179. return Behavior(options);
  1180. }
  1181. function isPage() {
  1182. return !!this.route;
  1183. }
  1184. function initRelation(detail) {
  1185. this.triggerEvent('__l', detail);
  1186. }
  1187. function selectAllComponents(mpInstance, selector, $refs) {
  1188. var components = mpInstance.selectAllComponents(selector);
  1189. components.forEach(function (component) {
  1190. var ref = component.dataset.ref;
  1191. $refs[ref] = component.$vm || component;
  1192. {
  1193. if (component.dataset.vueGeneric === 'scoped') {
  1194. component.selectAllComponents('.scoped-ref').forEach(function (scopedComponent) {
  1195. selectAllComponents(scopedComponent, selector, $refs);
  1196. });
  1197. }
  1198. }
  1199. });
  1200. }
  1201. function initRefs(vm) {
  1202. var mpInstance = vm.$scope;
  1203. Object.defineProperty(vm, '$refs', {
  1204. get: function get() {
  1205. var $refs = {};
  1206. selectAllComponents(mpInstance, '.vue-ref', $refs);
  1207. // TODO 暂不考虑 for 中的 scoped
  1208. var forComponents = mpInstance.selectAllComponents('.vue-ref-in-for');
  1209. forComponents.forEach(function (component) {
  1210. var ref = component.dataset.ref;
  1211. if (!$refs[ref]) {
  1212. $refs[ref] = [];
  1213. }
  1214. $refs[ref].push(component.$vm || component);
  1215. });
  1216. return $refs;
  1217. } });
  1218. }
  1219. function handleLink(event) {var _ref4 =
  1220. event.detail || event.value,vuePid = _ref4.vuePid,vueOptions = _ref4.vueOptions; // detail 是微信,value 是百度(dipatch)
  1221. var parentVm;
  1222. if (vuePid) {
  1223. parentVm = findVmByVueId(this.$vm, vuePid);
  1224. }
  1225. if (!parentVm) {
  1226. parentVm = this.$vm;
  1227. }
  1228. vueOptions.parent = parentVm;
  1229. }
  1230. function parseApp(vm) {
  1231. return parseBaseApp(vm, {
  1232. mocks: mocks,
  1233. initRefs: initRefs });
  1234. }
  1235. function createApp(vm) {
  1236. App(parseApp(vm));
  1237. return vm;
  1238. }
  1239. var encodeReserveRE = /[!'()*]/g;
  1240. var encodeReserveReplacer = function encodeReserveReplacer(c) {return '%' + c.charCodeAt(0).toString(16);};
  1241. var commaRE = /%2C/g;
  1242. // fixed encodeURIComponent which is more conformant to RFC3986:
  1243. // - escapes [!'()*]
  1244. // - preserve commas
  1245. var encode = function encode(str) {return encodeURIComponent(str).
  1246. replace(encodeReserveRE, encodeReserveReplacer).
  1247. replace(commaRE, ',');};
  1248. function stringifyQuery(obj) {var encodeStr = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : encode;
  1249. var res = obj ? Object.keys(obj).map(function (key) {
  1250. var val = obj[key];
  1251. if (val === undefined) {
  1252. return '';
  1253. }
  1254. if (val === null) {
  1255. return encodeStr(key);
  1256. }
  1257. if (Array.isArray(val)) {
  1258. var result = [];
  1259. val.forEach(function (val2) {
  1260. if (val2 === undefined) {
  1261. return;
  1262. }
  1263. if (val2 === null) {
  1264. result.push(encodeStr(key));
  1265. } else {
  1266. result.push(encodeStr(key) + '=' + encodeStr(val2));
  1267. }
  1268. });
  1269. return result.join('&');
  1270. }
  1271. return encodeStr(key) + '=' + encodeStr(val);
  1272. }).filter(function (x) {return x.length > 0;}).join('&') : null;
  1273. return res ? "?".concat(res) : '';
  1274. }
  1275. function parseBaseComponent(vueComponentOptions)
  1276. {var _ref5 = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {},isPage = _ref5.isPage,initRelation = _ref5.initRelation;var _initVueComponent =
  1277. initVueComponent(_vue.default, vueComponentOptions),_initVueComponent2 = _slicedToArray(_initVueComponent, 2),VueComponent = _initVueComponent2[0],vueOptions = _initVueComponent2[1];
  1278. var options = _objectSpread({
  1279. multipleSlots: true,
  1280. addGlobalClass: true },
  1281. vueOptions.options || {});
  1282. {
  1283. // 微信 multipleSlots 部分情况有 bug,导致内容顺序错乱 如 u-list,提供覆盖选项
  1284. if (vueOptions['mp-weixin'] && vueOptions['mp-weixin'].options) {
  1285. Object.assign(options, vueOptions['mp-weixin'].options);
  1286. }
  1287. }
  1288. var componentOptions = {
  1289. options: options,
  1290. data: initData(vueOptions, _vue.default.prototype),
  1291. behaviors: initBehaviors(vueOptions, initBehavior),
  1292. properties: initProperties(vueOptions.props, false, vueOptions.__file),
  1293. lifetimes: {
  1294. attached: function attached() {
  1295. var properties = this.properties;
  1296. var options = {
  1297. mpType: isPage.call(this) ? 'page' : 'component',
  1298. mpInstance: this,
  1299. propsData: properties };
  1300. initVueIds(properties.vueId, this);
  1301. // 处理父子关系
  1302. initRelation.call(this, {
  1303. vuePid: this._$vuePid,
  1304. vueOptions: options });
  1305. // 初始化 vue 实例
  1306. this.$vm = new VueComponent(options);
  1307. // 处理$slots,$scopedSlots(暂不支持动态变化$slots)
  1308. initSlots(this.$vm, properties.vueSlots);
  1309. // 触发首次 setData
  1310. this.$vm.$mount();
  1311. },
  1312. ready: function ready() {
  1313. // 当组件 props 默认值为 true,初始化时传入 false 会导致 created,ready 触发, 但 attached 不触发
  1314. // https://developers.weixin.qq.com/community/develop/doc/00066ae2844cc0f8eb883e2a557800
  1315. if (this.$vm) {
  1316. this.$vm._isMounted = true;
  1317. this.$vm.__call_hook('mounted');
  1318. this.$vm.__call_hook('onReady');
  1319. }
  1320. },
  1321. detached: function detached() {
  1322. this.$vm && this.$vm.$destroy();
  1323. } },
  1324. pageLifetimes: {
  1325. show: function show(args) {
  1326. this.$vm && this.$vm.__call_hook('onPageShow', args);
  1327. },
  1328. hide: function hide() {
  1329. this.$vm && this.$vm.__call_hook('onPageHide');
  1330. },
  1331. resize: function resize(size) {
  1332. this.$vm && this.$vm.__call_hook('onPageResize', size);
  1333. } },
  1334. methods: {
  1335. __l: handleLink,
  1336. __e: handleEvent } };
  1337. // externalClasses
  1338. if (vueOptions.externalClasses) {
  1339. componentOptions.externalClasses = vueOptions.externalClasses;
  1340. }
  1341. if (Array.isArray(vueOptions.wxsCallMethods)) {
  1342. vueOptions.wxsCallMethods.forEach(function (callMethod) {
  1343. componentOptions.methods[callMethod] = function (args) {
  1344. return this.$vm[callMethod](args);
  1345. };
  1346. });
  1347. }
  1348. if (isPage) {
  1349. return componentOptions;
  1350. }
  1351. return [componentOptions, VueComponent];
  1352. }
  1353. function parseComponent(vueComponentOptions) {
  1354. return parseBaseComponent(vueComponentOptions, {
  1355. isPage: isPage,
  1356. initRelation: initRelation });
  1357. }
  1358. var hooks$1 = [
  1359. 'onShow',
  1360. 'onHide',
  1361. 'onUnload'];
  1362. hooks$1.push.apply(hooks$1, PAGE_EVENT_HOOKS);
  1363. function parseBasePage(vuePageOptions, _ref6)
  1364. {var isPage = _ref6.isPage,initRelation = _ref6.initRelation;
  1365. var pageOptions = parseComponent(vuePageOptions);
  1366. initHooks(pageOptions.methods, hooks$1, vuePageOptions);
  1367. pageOptions.methods.onLoad = function (query) {
  1368. this.options = query;
  1369. var copyQuery = Object.assign({}, query);
  1370. delete copyQuery.__id__;
  1371. this.$page = {
  1372. fullPath: '/' + (this.route || this.is) + stringifyQuery(copyQuery) };
  1373. this.$vm.$mp.query = query; // 兼容 mpvue
  1374. this.$vm.__call_hook('onLoad', query);
  1375. };
  1376. return pageOptions;
  1377. }
  1378. function parsePage(vuePageOptions) {
  1379. return parseBasePage(vuePageOptions, {
  1380. isPage: isPage,
  1381. initRelation: initRelation });
  1382. }
  1383. function createPage(vuePageOptions) {
  1384. {
  1385. return Component(parsePage(vuePageOptions));
  1386. }
  1387. }
  1388. function createComponent(vueOptions) {
  1389. {
  1390. return Component(parseComponent(vueOptions));
  1391. }
  1392. }
  1393. function createSubpackageApp(vm) {
  1394. var appOptions = parseApp(vm);
  1395. var app = getApp({
  1396. allowDefault: true });
  1397. var globalData = app.globalData;
  1398. if (globalData) {
  1399. Object.keys(appOptions.globalData).forEach(function (name) {
  1400. if (!hasOwn(globalData, name)) {
  1401. globalData[name] = appOptions.globalData[name];
  1402. }
  1403. });
  1404. }
  1405. Object.keys(appOptions).forEach(function (name) {
  1406. if (!hasOwn(app, name)) {
  1407. app[name] = appOptions[name];
  1408. }
  1409. });
  1410. if (isFn(appOptions.onShow) && wx.onAppShow) {
  1411. wx.onAppShow(function () {for (var _len5 = arguments.length, args = new Array(_len5), _key5 = 0; _key5 < _len5; _key5++) {args[_key5] = arguments[_key5];}
  1412. appOptions.onShow.apply(app, args);
  1413. });
  1414. }
  1415. if (isFn(appOptions.onHide) && wx.onAppHide) {
  1416. wx.onAppHide(function () {for (var _len6 = arguments.length, args = new Array(_len6), _key6 = 0; _key6 < _len6; _key6++) {args[_key6] = arguments[_key6];}
  1417. appOptions.onHide.apply(app, args);
  1418. });
  1419. }
  1420. if (isFn(appOptions.onLaunch)) {
  1421. var args = wx.getLaunchOptionsSync && wx.getLaunchOptionsSync();
  1422. appOptions.onLaunch.call(app, args);
  1423. }
  1424. return vm;
  1425. }
  1426. todos.forEach(function (todoApi) {
  1427. protocols[todoApi] = false;
  1428. });
  1429. canIUses.forEach(function (canIUseApi) {
  1430. var apiName = protocols[canIUseApi] && protocols[canIUseApi].name ? protocols[canIUseApi].name :
  1431. canIUseApi;
  1432. if (!wx.canIUse(apiName)) {
  1433. protocols[canIUseApi] = false;
  1434. }
  1435. });
  1436. var uni = {};
  1437. if (typeof Proxy !== 'undefined' && "mp-weixin" !== 'app-plus') {
  1438. uni = new Proxy({}, {
  1439. get: function get(target, name) {
  1440. if (hasOwn(target, name)) {
  1441. return target[name];
  1442. }
  1443. if (baseApi[name]) {
  1444. return baseApi[name];
  1445. }
  1446. if (api[name]) {
  1447. return promisify(name, api[name]);
  1448. }
  1449. {
  1450. if (extraApi[name]) {
  1451. return promisify(name, extraApi[name]);
  1452. }
  1453. if (todoApis[name]) {
  1454. return promisify(name, todoApis[name]);
  1455. }
  1456. }
  1457. if (eventApi[name]) {
  1458. return eventApi[name];
  1459. }
  1460. if (!hasOwn(wx, name) && !hasOwn(protocols, name)) {
  1461. return;
  1462. }
  1463. return promisify(name, wrapper(name, wx[name]));
  1464. },
  1465. set: function set(target, name, value) {
  1466. target[name] = value;
  1467. return true;
  1468. } });
  1469. } else {
  1470. Object.keys(baseApi).forEach(function (name) {
  1471. uni[name] = baseApi[name];
  1472. });
  1473. {
  1474. Object.keys(todoApis).forEach(function (name) {
  1475. uni[name] = promisify(name, todoApis[name]);
  1476. });
  1477. Object.keys(extraApi).forEach(function (name) {
  1478. uni[name] = promisify(name, todoApis[name]);
  1479. });
  1480. }
  1481. Object.keys(eventApi).forEach(function (name) {
  1482. uni[name] = eventApi[name];
  1483. });
  1484. Object.keys(api).forEach(function (name) {
  1485. uni[name] = promisify(name, api[name]);
  1486. });
  1487. Object.keys(wx).forEach(function (name) {
  1488. if (hasOwn(wx, name) || hasOwn(protocols, name)) {
  1489. uni[name] = promisify(name, wrapper(name, wx[name]));
  1490. }
  1491. });
  1492. }
  1493. wx.createApp = createApp;
  1494. wx.createPage = createPage;
  1495. wx.createComponent = createComponent;
  1496. wx.createSubpackageApp = createSubpackageApp;
  1497. var uni$1 = uni;var _default =
  1498. uni$1;exports.default = _default;
  1499. /***/ }),
  1500. /* 2 */
  1501. /*!******************************************************************************************!*\
  1502. !*** ./node_modules/@dcloudio/vue-cli-plugin-uni/packages/mp-vue/dist/mp.runtime.esm.js ***!
  1503. \******************************************************************************************/
  1504. /*! exports provided: default */
  1505. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  1506. "use strict";
  1507. __webpack_require__.r(__webpack_exports__);
  1508. /* WEBPACK VAR INJECTION */(function(global) {/*!
  1509. * Vue.js v2.6.11
  1510. * (c) 2014-2021 Evan You
  1511. * Released under the MIT License.
  1512. */
  1513. /* */
  1514. var emptyObject = Object.freeze({});
  1515. // These helpers produce better VM code in JS engines due to their
  1516. // explicitness and function inlining.
  1517. function isUndef (v) {
  1518. return v === undefined || v === null
  1519. }
  1520. function isDef (v) {
  1521. return v !== undefined && v !== null
  1522. }
  1523. function isTrue (v) {
  1524. return v === true
  1525. }
  1526. function isFalse (v) {
  1527. return v === false
  1528. }
  1529. /**
  1530. * Check if value is primitive.
  1531. */
  1532. function isPrimitive (value) {
  1533. return (
  1534. typeof value === 'string' ||
  1535. typeof value === 'number' ||
  1536. // $flow-disable-line
  1537. typeof value === 'symbol' ||
  1538. typeof value === 'boolean'
  1539. )
  1540. }
  1541. /**
  1542. * Quick object check - this is primarily used to tell
  1543. * Objects from primitive values when we know the value
  1544. * is a JSON-compliant type.
  1545. */
  1546. function isObject (obj) {
  1547. return obj !== null && typeof obj === 'object'
  1548. }
  1549. /**
  1550. * Get the raw type string of a value, e.g., [object Object].
  1551. */
  1552. var _toString = Object.prototype.toString;
  1553. function toRawType (value) {
  1554. return _toString.call(value).slice(8, -1)
  1555. }
  1556. /**
  1557. * Strict object type check. Only returns true
  1558. * for plain JavaScript objects.
  1559. */
  1560. function isPlainObject (obj) {
  1561. return _toString.call(obj) === '[object Object]'
  1562. }
  1563. function isRegExp (v) {
  1564. return _toString.call(v) === '[object RegExp]'
  1565. }
  1566. /**
  1567. * Check if val is a valid array index.
  1568. */
  1569. function isValidArrayIndex (val) {
  1570. var n = parseFloat(String(val));
  1571. return n >= 0 && Math.floor(n) === n && isFinite(val)
  1572. }
  1573. function isPromise (val) {
  1574. return (
  1575. isDef(val) &&
  1576. typeof val.then === 'function' &&
  1577. typeof val.catch === 'function'
  1578. )
  1579. }
  1580. /**
  1581. * Convert a value to a string that is actually rendered.
  1582. */
  1583. function toString (val) {
  1584. return val == null
  1585. ? ''
  1586. : Array.isArray(val) || (isPlainObject(val) && val.toString === _toString)
  1587. ? JSON.stringify(val, null, 2)
  1588. : String(val)
  1589. }
  1590. /**
  1591. * Convert an input value to a number for persistence.
  1592. * If the conversion fails, return original string.
  1593. */
  1594. function toNumber (val) {
  1595. var n = parseFloat(val);
  1596. return isNaN(n) ? val : n
  1597. }
  1598. /**
  1599. * Make a map and return a function for checking if a key
  1600. * is in that map.
  1601. */
  1602. function makeMap (
  1603. str,
  1604. expectsLowerCase
  1605. ) {
  1606. var map = Object.create(null);
  1607. var list = str.split(',');
  1608. for (var i = 0; i < list.length; i++) {
  1609. map[list[i]] = true;
  1610. }
  1611. return expectsLowerCase
  1612. ? function (val) { return map[val.toLowerCase()]; }
  1613. : function (val) { return map[val]; }
  1614. }
  1615. /**
  1616. * Check if a tag is a built-in tag.
  1617. */
  1618. var isBuiltInTag = makeMap('slot,component', true);
  1619. /**
  1620. * Check if an attribute is a reserved attribute.
  1621. */
  1622. var isReservedAttribute = makeMap('key,ref,slot,slot-scope,is');
  1623. /**
  1624. * Remove an item from an array.
  1625. */
  1626. function remove (arr, item) {
  1627. if (arr.length) {
  1628. var index = arr.indexOf(item);
  1629. if (index > -1) {
  1630. return arr.splice(index, 1)
  1631. }
  1632. }
  1633. }
  1634. /**
  1635. * Check whether an object has the property.
  1636. */
  1637. var hasOwnProperty = Object.prototype.hasOwnProperty;
  1638. function hasOwn (obj, key) {
  1639. return hasOwnProperty.call(obj, key)
  1640. }
  1641. /**
  1642. * Create a cached version of a pure function.
  1643. */
  1644. function cached (fn) {
  1645. var cache = Object.create(null);
  1646. return (function cachedFn (str) {
  1647. var hit = cache[str];
  1648. return hit || (cache[str] = fn(str))
  1649. })
  1650. }
  1651. /**
  1652. * Camelize a hyphen-delimited string.
  1653. */
  1654. var camelizeRE = /-(\w)/g;
  1655. var camelize = cached(function (str) {
  1656. return str.replace(camelizeRE, function (_, c) { return c ? c.toUpperCase() : ''; })
  1657. });
  1658. /**
  1659. * Capitalize a string.
  1660. */
  1661. var capitalize = cached(function (str) {
  1662. return str.charAt(0).toUpperCase() + str.slice(1)
  1663. });
  1664. /**
  1665. * Hyphenate a camelCase string.
  1666. */
  1667. var hyphenateRE = /\B([A-Z])/g;
  1668. var hyphenate = cached(function (str) {
  1669. return str.replace(hyphenateRE, '-$1').toLowerCase()
  1670. });
  1671. /**
  1672. * Simple bind polyfill for environments that do not support it,
  1673. * e.g., PhantomJS 1.x. Technically, we don't need this anymore
  1674. * since native bind is now performant enough in most browsers.
  1675. * But removing it would mean breaking code that was able to run in
  1676. * PhantomJS 1.x, so this must be kept for backward compatibility.
  1677. */
  1678. /* istanbul ignore next */
  1679. function polyfillBind (fn, ctx) {
  1680. function boundFn (a) {
  1681. var l = arguments.length;
  1682. return l
  1683. ? l > 1
  1684. ? fn.apply(ctx, arguments)
  1685. : fn.call(ctx, a)
  1686. : fn.call(ctx)
  1687. }
  1688. boundFn._length = fn.length;
  1689. return boundFn
  1690. }
  1691. function nativeBind (fn, ctx) {
  1692. return fn.bind(ctx)
  1693. }
  1694. var bind = Function.prototype.bind
  1695. ? nativeBind
  1696. : polyfillBind;
  1697. /**
  1698. * Convert an Array-like object to a real Array.
  1699. */
  1700. function toArray (list, start) {
  1701. start = start || 0;
  1702. var i = list.length - start;
  1703. var ret = new Array(i);
  1704. while (i--) {
  1705. ret[i] = list[i + start];
  1706. }
  1707. return ret
  1708. }
  1709. /**
  1710. * Mix properties into target object.
  1711. */
  1712. function extend (to, _from) {
  1713. for (var key in _from) {
  1714. to[key] = _from[key];
  1715. }
  1716. return to
  1717. }
  1718. /**
  1719. * Merge an Array of Objects into a single Object.
  1720. */
  1721. function toObject (arr) {
  1722. var res = {};
  1723. for (var i = 0; i < arr.length; i++) {
  1724. if (arr[i]) {
  1725. extend(res, arr[i]);
  1726. }
  1727. }
  1728. return res
  1729. }
  1730. /* eslint-disable no-unused-vars */
  1731. /**
  1732. * Perform no operation.
  1733. * Stubbing args to make Flow happy without leaving useless transpiled code
  1734. * with ...rest (https://flow.org/blog/2017/05/07/Strict-Function-Call-Arity/).
  1735. */
  1736. function noop (a, b, c) {}
  1737. /**
  1738. * Always return false.
  1739. */
  1740. var no = function (a, b, c) { return false; };
  1741. /* eslint-enable no-unused-vars */
  1742. /**
  1743. * Return the same value.
  1744. */
  1745. var identity = function (_) { return _; };
  1746. /**
  1747. * Check if two values are loosely equal - that is,
  1748. * if they are plain objects, do they have the same shape?
  1749. */
  1750. function looseEqual (a, b) {
  1751. if (a === b) { return true }
  1752. var isObjectA = isObject(a);
  1753. var isObjectB = isObject(b);
  1754. if (isObjectA && isObjectB) {
  1755. try {
  1756. var isArrayA = Array.isArray(a);
  1757. var isArrayB = Array.isArray(b);
  1758. if (isArrayA && isArrayB) {
  1759. return a.length === b.length && a.every(function (e, i) {
  1760. return looseEqual(e, b[i])
  1761. })
  1762. } else if (a instanceof Date && b instanceof Date) {
  1763. return a.getTime() === b.getTime()
  1764. } else if (!isArrayA && !isArrayB) {
  1765. var keysA = Object.keys(a);
  1766. var keysB = Object.keys(b);
  1767. return keysA.length === keysB.length && keysA.every(function (key) {
  1768. return looseEqual(a[key], b[key])
  1769. })
  1770. } else {
  1771. /* istanbul ignore next */
  1772. return false
  1773. }
  1774. } catch (e) {
  1775. /* istanbul ignore next */
  1776. return false
  1777. }
  1778. } else if (!isObjectA && !isObjectB) {
  1779. return String(a) === String(b)
  1780. } else {
  1781. return false
  1782. }
  1783. }
  1784. /**
  1785. * Return the first index at which a loosely equal value can be
  1786. * found in the array (if value is a plain object, the array must
  1787. * contain an object of the same shape), or -1 if it is not present.
  1788. */
  1789. function looseIndexOf (arr, val) {
  1790. for (var i = 0; i < arr.length; i++) {
  1791. if (looseEqual(arr[i], val)) { return i }
  1792. }
  1793. return -1
  1794. }
  1795. /**
  1796. * Ensure a function is called only once.
  1797. */
  1798. function once (fn) {
  1799. var called = false;
  1800. return function () {
  1801. if (!called) {
  1802. called = true;
  1803. fn.apply(this, arguments);
  1804. }
  1805. }
  1806. }
  1807. var ASSET_TYPES = [
  1808. 'component',
  1809. 'directive',
  1810. 'filter'
  1811. ];
  1812. var LIFECYCLE_HOOKS = [
  1813. 'beforeCreate',
  1814. 'created',
  1815. 'beforeMount',
  1816. 'mounted',
  1817. 'beforeUpdate',
  1818. 'updated',
  1819. 'beforeDestroy',
  1820. 'destroyed',
  1821. 'activated',
  1822. 'deactivated',
  1823. 'errorCaptured',
  1824. 'serverPrefetch'
  1825. ];
  1826. /* */
  1827. var config = ({
  1828. /**
  1829. * Option merge strategies (used in core/util/options)
  1830. */
  1831. // $flow-disable-line
  1832. optionMergeStrategies: Object.create(null),
  1833. /**
  1834. * Whether to suppress warnings.
  1835. */
  1836. silent: false,
  1837. /**
  1838. * Show production mode tip message on boot?
  1839. */
  1840. productionTip: "development" !== 'production',
  1841. /**
  1842. * Whether to enable devtools
  1843. */
  1844. devtools: "development" !== 'production',
  1845. /**
  1846. * Whether to record perf
  1847. */
  1848. performance: false,
  1849. /**
  1850. * Error handler for watcher errors
  1851. */
  1852. errorHandler: null,
  1853. /**
  1854. * Warn handler for watcher warns
  1855. */
  1856. warnHandler: null,
  1857. /**
  1858. * Ignore certain custom elements
  1859. */
  1860. ignoredElements: [],
  1861. /**
  1862. * Custom user key aliases for v-on
  1863. */
  1864. // $flow-disable-line
  1865. keyCodes: Object.create(null),
  1866. /**
  1867. * Check if a tag is reserved so that it cannot be registered as a
  1868. * component. This is platform-dependent and may be overwritten.
  1869. */
  1870. isReservedTag: no,
  1871. /**
  1872. * Check if an attribute is reserved so that it cannot be used as a component
  1873. * prop. This is platform-dependent and may be overwritten.
  1874. */
  1875. isReservedAttr: no,
  1876. /**
  1877. * Check if a tag is an unknown element.
  1878. * Platform-dependent.
  1879. */
  1880. isUnknownElement: no,
  1881. /**
  1882. * Get the namespace of an element
  1883. */
  1884. getTagNamespace: noop,
  1885. /**
  1886. * Parse the real tag name for the specific platform.
  1887. */
  1888. parsePlatformTagName: identity,
  1889. /**
  1890. * Check if an attribute must be bound using property, e.g. value
  1891. * Platform-dependent.
  1892. */
  1893. mustUseProp: no,
  1894. /**
  1895. * Perform updates asynchronously. Intended to be used by Vue Test Utils
  1896. * This will significantly reduce performance if set to false.
  1897. */
  1898. async: true,
  1899. /**
  1900. * Exposed for legacy reasons
  1901. */
  1902. _lifecycleHooks: LIFECYCLE_HOOKS
  1903. });
  1904. /* */
  1905. /**
  1906. * unicode letters used for parsing html tags, component names and property paths.
  1907. * using https://www.w3.org/TR/html53/semantics-scripting.html#potentialcustomelementname
  1908. * skipping \u10000-\uEFFFF due to it freezing up PhantomJS
  1909. */
  1910. var unicodeRegExp = /a-zA-Z\u00B7\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u037D\u037F-\u1FFF\u200C-\u200D\u203F-\u2040\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD/;
  1911. /**
  1912. * Check if a string starts with $ or _
  1913. */
  1914. function isReserved (str) {
  1915. var c = (str + '').charCodeAt(0);
  1916. return c === 0x24 || c === 0x5F
  1917. }
  1918. /**
  1919. * Define a property.
  1920. */
  1921. function def (obj, key, val, enumerable) {
  1922. Object.defineProperty(obj, key, {
  1923. value: val,
  1924. enumerable: !!enumerable,
  1925. writable: true,
  1926. configurable: true
  1927. });
  1928. }
  1929. /**
  1930. * Parse simple path.
  1931. */
  1932. var bailRE = new RegExp(("[^" + (unicodeRegExp.source) + ".$_\\d]"));
  1933. function parsePath (path) {
  1934. if (bailRE.test(path)) {
  1935. return
  1936. }
  1937. var segments = path.split('.');
  1938. return function (obj) {
  1939. for (var i = 0; i < segments.length; i++) {
  1940. if (!obj) { return }
  1941. obj = obj[segments[i]];
  1942. }
  1943. return obj
  1944. }
  1945. }
  1946. /* */
  1947. // can we use __proto__?
  1948. var hasProto = '__proto__' in {};
  1949. // Browser environment sniffing
  1950. var inBrowser = typeof window !== 'undefined';
  1951. var inWeex = typeof WXEnvironment !== 'undefined' && !!WXEnvironment.platform;
  1952. var weexPlatform = inWeex && WXEnvironment.platform.toLowerCase();
  1953. var UA = inBrowser && window.navigator.userAgent.toLowerCase();
  1954. var isIE = UA && /msie|trident/.test(UA);
  1955. var isIE9 = UA && UA.indexOf('msie 9.0') > 0;
  1956. var isEdge = UA && UA.indexOf('edge/') > 0;
  1957. var isAndroid = (UA && UA.indexOf('android') > 0) || (weexPlatform === 'android');
  1958. var isIOS = (UA && /iphone|ipad|ipod|ios/.test(UA)) || (weexPlatform === 'ios');
  1959. var isChrome = UA && /chrome\/\d+/.test(UA) && !isEdge;
  1960. var isPhantomJS = UA && /phantomjs/.test(UA);
  1961. var isFF = UA && UA.match(/firefox\/(\d+)/);
  1962. // Firefox has a "watch" function on Object.prototype...
  1963. var nativeWatch = ({}).watch;
  1964. if (inBrowser) {
  1965. try {
  1966. var opts = {};
  1967. Object.defineProperty(opts, 'passive', ({
  1968. get: function get () {
  1969. }
  1970. })); // https://github.com/facebook/flow/issues/285
  1971. window.addEventListener('test-passive', null, opts);
  1972. } catch (e) {}
  1973. }
  1974. // this needs to be lazy-evaled because vue may be required before
  1975. // vue-server-renderer can set VUE_ENV
  1976. var _isServer;
  1977. var isServerRendering = function () {
  1978. if (_isServer === undefined) {
  1979. /* istanbul ignore if */
  1980. if (!inBrowser && !inWeex && typeof global !== 'undefined') {
  1981. // detect presence of vue-server-renderer and avoid
  1982. // Webpack shimming the process
  1983. _isServer = global['process'] && global['process'].env.VUE_ENV === 'server';
  1984. } else {
  1985. _isServer = false;
  1986. }
  1987. }
  1988. return _isServer
  1989. };
  1990. // detect devtools
  1991. var devtools = inBrowser && window.__VUE_DEVTOOLS_GLOBAL_HOOK__;
  1992. /* istanbul ignore next */
  1993. function isNative (Ctor) {
  1994. return typeof Ctor === 'function' && /native code/.test(Ctor.toString())
  1995. }
  1996. var hasSymbol =
  1997. typeof Symbol !== 'undefined' && isNative(Symbol) &&
  1998. typeof Reflect !== 'undefined' && isNative(Reflect.ownKeys);
  1999. var _Set;
  2000. /* istanbul ignore if */ // $flow-disable-line
  2001. if (typeof Set !== 'undefined' && isNative(Set)) {
  2002. // use native Set when available.
  2003. _Set = Set;
  2004. } else {
  2005. // a non-standard Set polyfill that only works with primitive keys.
  2006. _Set = /*@__PURE__*/(function () {
  2007. function Set () {
  2008. this.set = Object.create(null);
  2009. }
  2010. Set.prototype.has = function has (key) {
  2011. return this.set[key] === true
  2012. };
  2013. Set.prototype.add = function add (key) {
  2014. this.set[key] = true;
  2015. };
  2016. Set.prototype.clear = function clear () {
  2017. this.set = Object.create(null);
  2018. };
  2019. return Set;
  2020. }());
  2021. }
  2022. /* */
  2023. var warn = noop;
  2024. var tip = noop;
  2025. var generateComponentTrace = (noop); // work around flow check
  2026. var formatComponentName = (noop);
  2027. if (true) {
  2028. var hasConsole = typeof console !== 'undefined';
  2029. var classifyRE = /(?:^|[-_])(\w)/g;
  2030. var classify = function (str) { return str
  2031. .replace(classifyRE, function (c) { return c.toUpperCase(); })
  2032. .replace(/[-_]/g, ''); };
  2033. warn = function (msg, vm) {
  2034. var trace = vm ? generateComponentTrace(vm) : '';
  2035. if (config.warnHandler) {
  2036. config.warnHandler.call(null, msg, vm, trace);
  2037. } else if (hasConsole && (!config.silent)) {
  2038. console.error(("[Vue warn]: " + msg + trace));
  2039. }
  2040. };
  2041. tip = function (msg, vm) {
  2042. if (hasConsole && (!config.silent)) {
  2043. console.warn("[Vue tip]: " + msg + (
  2044. vm ? generateComponentTrace(vm) : ''
  2045. ));
  2046. }
  2047. };
  2048. formatComponentName = function (vm, includeFile) {
  2049. if (vm.$root === vm) {
  2050. if (vm.$options && vm.$options.__file) { // fixed by xxxxxx
  2051. return ('') + vm.$options.__file
  2052. }
  2053. return '<Root>'
  2054. }
  2055. var options = typeof vm === 'function' && vm.cid != null
  2056. ? vm.options
  2057. : vm._isVue
  2058. ? vm.$options || vm.constructor.options
  2059. : vm;
  2060. var name = options.name || options._componentTag;
  2061. var file = options.__file;
  2062. if (!name && file) {
  2063. var match = file.match(/([^/\\]+)\.vue$/);
  2064. name = match && match[1];
  2065. }
  2066. return (
  2067. (name ? ("<" + (classify(name)) + ">") : "<Anonymous>") +
  2068. (file && includeFile !== false ? (" at " + file) : '')
  2069. )
  2070. };
  2071. var repeat = function (str, n) {
  2072. var res = '';
  2073. while (n) {
  2074. if (n % 2 === 1) { res += str; }
  2075. if (n > 1) { str += str; }
  2076. n >>= 1;
  2077. }
  2078. return res
  2079. };
  2080. generateComponentTrace = function (vm) {
  2081. if (vm._isVue && vm.$parent) {
  2082. var tree = [];
  2083. var currentRecursiveSequence = 0;
  2084. while (vm && vm.$options.name !== 'PageBody') {
  2085. if (tree.length > 0) {
  2086. var last = tree[tree.length - 1];
  2087. if (last.constructor === vm.constructor) {
  2088. currentRecursiveSequence++;
  2089. vm = vm.$parent;
  2090. continue
  2091. } else if (currentRecursiveSequence > 0) {
  2092. tree[tree.length - 1] = [last, currentRecursiveSequence];
  2093. currentRecursiveSequence = 0;
  2094. }
  2095. }
  2096. !vm.$options.isReserved && tree.push(vm);
  2097. vm = vm.$parent;
  2098. }
  2099. return '\n\nfound in\n\n' + tree
  2100. .map(function (vm, i) { return ("" + (i === 0 ? '---> ' : repeat(' ', 5 + i * 2)) + (Array.isArray(vm)
  2101. ? ((formatComponentName(vm[0])) + "... (" + (vm[1]) + " recursive calls)")
  2102. : formatComponentName(vm))); })
  2103. .join('\n')
  2104. } else {
  2105. return ("\n\n(found in " + (formatComponentName(vm)) + ")")
  2106. }
  2107. };
  2108. }
  2109. /* */
  2110. var uid = 0;
  2111. /**
  2112. * A dep is an observable that can have multiple
  2113. * directives subscribing to it.
  2114. */
  2115. var Dep = function Dep () {
  2116. this.id = uid++;
  2117. this.subs = [];
  2118. };
  2119. Dep.prototype.addSub = function addSub (sub) {
  2120. this.subs.push(sub);
  2121. };
  2122. Dep.prototype.removeSub = function removeSub (sub) {
  2123. remove(this.subs, sub);
  2124. };
  2125. Dep.prototype.depend = function depend () {
  2126. if (Dep.SharedObject.target) {
  2127. Dep.SharedObject.target.addDep(this);
  2128. }
  2129. };
  2130. Dep.prototype.notify = function notify () {
  2131. // stabilize the subscriber list first
  2132. var subs = this.subs.slice();
  2133. if ( true && !config.async) {
  2134. // subs aren't sorted in scheduler if not running async
  2135. // we need to sort them now to make sure they fire in correct
  2136. // order
  2137. subs.sort(function (a, b) { return a.id - b.id; });
  2138. }
  2139. for (var i = 0, l = subs.length; i < l; i++) {
  2140. subs[i].update();
  2141. }
  2142. };
  2143. // The current target watcher being evaluated.
  2144. // This is globally unique because only one watcher
  2145. // can be evaluated at a time.
  2146. // fixed by xxxxxx (nvue shared vuex)
  2147. /* eslint-disable no-undef */
  2148. Dep.SharedObject = {};
  2149. Dep.SharedObject.target = null;
  2150. Dep.SharedObject.targetStack = [];
  2151. function pushTarget (target) {
  2152. Dep.SharedObject.targetStack.push(target);
  2153. Dep.SharedObject.target = target;
  2154. Dep.target = target;
  2155. }
  2156. function popTarget () {
  2157. Dep.SharedObject.targetStack.pop();
  2158. Dep.SharedObject.target = Dep.SharedObject.targetStack[Dep.SharedObject.targetStack.length - 1];
  2159. Dep.target = Dep.SharedObject.target;
  2160. }
  2161. /* */
  2162. var VNode = function VNode (
  2163. tag,
  2164. data,
  2165. children,
  2166. text,
  2167. elm,
  2168. context,
  2169. componentOptions,
  2170. asyncFactory
  2171. ) {
  2172. this.tag = tag;
  2173. this.data = data;
  2174. this.children = children;
  2175. this.text = text;
  2176. this.elm = elm;
  2177. this.ns = undefined;
  2178. this.context = context;
  2179. this.fnContext = undefined;
  2180. this.fnOptions = undefined;
  2181. this.fnScopeId = undefined;
  2182. this.key = data && data.key;
  2183. this.componentOptions = componentOptions;
  2184. this.componentInstance = undefined;
  2185. this.parent = undefined;
  2186. this.raw = false;
  2187. this.isStatic = false;
  2188. this.isRootInsert = true;
  2189. this.isComment = false;
  2190. this.isCloned = false;
  2191. this.isOnce = false;
  2192. this.asyncFactory = asyncFactory;
  2193. this.asyncMeta = undefined;
  2194. this.isAsyncPlaceholder = false;
  2195. };
  2196. var prototypeAccessors = { child: { configurable: true } };
  2197. // DEPRECATED: alias for componentInstance for backwards compat.
  2198. /* istanbul ignore next */
  2199. prototypeAccessors.child.get = function () {
  2200. return this.componentInstance
  2201. };
  2202. Object.defineProperties( VNode.prototype, prototypeAccessors );
  2203. var createEmptyVNode = function (text) {
  2204. if ( text === void 0 ) text = '';
  2205. var node = new VNode();
  2206. node.text = text;
  2207. node.isComment = true;
  2208. return node
  2209. };
  2210. function createTextVNode (val) {
  2211. return new VNode(undefined, undefined, undefined, String(val))
  2212. }
  2213. // optimized shallow clone
  2214. // used for static nodes and slot nodes because they may be reused across
  2215. // multiple renders, cloning them avoids errors when DOM manipulations rely
  2216. // on their elm reference.
  2217. function cloneVNode (vnode) {
  2218. var cloned = new VNode(
  2219. vnode.tag,
  2220. vnode.data,
  2221. // #7975
  2222. // clone children array to avoid mutating original in case of cloning
  2223. // a child.
  2224. vnode.children && vnode.children.slice(),
  2225. vnode.text,
  2226. vnode.elm,
  2227. vnode.context,
  2228. vnode.componentOptions,
  2229. vnode.asyncFactory
  2230. );
  2231. cloned.ns = vnode.ns;
  2232. cloned.isStatic = vnode.isStatic;
  2233. cloned.key = vnode.key;
  2234. cloned.isComment = vnode.isComment;
  2235. cloned.fnContext = vnode.fnContext;
  2236. cloned.fnOptions = vnode.fnOptions;
  2237. cloned.fnScopeId = vnode.fnScopeId;
  2238. cloned.asyncMeta = vnode.asyncMeta;
  2239. cloned.isCloned = true;
  2240. return cloned
  2241. }
  2242. /*
  2243. * not type checking this file because flow doesn't play well with
  2244. * dynamically accessing methods on Array prototype
  2245. */
  2246. var arrayProto = Array.prototype;
  2247. var arrayMethods = Object.create(arrayProto);
  2248. var methodsToPatch = [
  2249. 'push',
  2250. 'pop',
  2251. 'shift',
  2252. 'unshift',
  2253. 'splice',
  2254. 'sort',
  2255. 'reverse'
  2256. ];
  2257. /**
  2258. * Intercept mutating methods and emit events
  2259. */
  2260. methodsToPatch.forEach(function (method) {
  2261. // cache original method
  2262. var original = arrayProto[method];
  2263. def(arrayMethods, method, function mutator () {
  2264. var args = [], len = arguments.length;
  2265. while ( len-- ) args[ len ] = arguments[ len ];
  2266. var result = original.apply(this, args);
  2267. var ob = this.__ob__;
  2268. var inserted;
  2269. switch (method) {
  2270. case 'push':
  2271. case 'unshift':
  2272. inserted = args;
  2273. break
  2274. case 'splice':
  2275. inserted = args.slice(2);
  2276. break
  2277. }
  2278. if (inserted) { ob.observeArray(inserted); }
  2279. // notify change
  2280. ob.dep.notify();
  2281. return result
  2282. });
  2283. });
  2284. /* */
  2285. var arrayKeys = Object.getOwnPropertyNames(arrayMethods);
  2286. /**
  2287. * In some cases we may want to disable observation inside a component's
  2288. * update computation.
  2289. */
  2290. var shouldObserve = true;
  2291. function toggleObserving (value) {
  2292. shouldObserve = value;
  2293. }
  2294. /**
  2295. * Observer class that is attached to each observed
  2296. * object. Once attached, the observer converts the target
  2297. * object's property keys into getter/setters that
  2298. * collect dependencies and dispatch updates.
  2299. */
  2300. var Observer = function Observer (value) {
  2301. this.value = value;
  2302. this.dep = new Dep();
  2303. this.vmCount = 0;
  2304. def(value, '__ob__', this);
  2305. if (Array.isArray(value)) {
  2306. if (hasProto) {
  2307. {// fixed by xxxxxx 微信小程序使用 plugins 之后,数组方法被直接挂载到了数组对象上,需要执行 copyAugment 逻辑
  2308. if(value.push !== value.__proto__.push){
  2309. copyAugment(value, arrayMethods, arrayKeys);
  2310. } else {
  2311. protoAugment(value, arrayMethods);
  2312. }
  2313. }
  2314. } else {
  2315. copyAugment(value, arrayMethods, arrayKeys);
  2316. }
  2317. this.observeArray(value);
  2318. } else {
  2319. this.walk(value);
  2320. }
  2321. };
  2322. /**
  2323. * Walk through all properties and convert them into
  2324. * getter/setters. This method should only be called when
  2325. * value type is Object.
  2326. */
  2327. Observer.prototype.walk = function walk (obj) {
  2328. var keys = Object.keys(obj);
  2329. for (var i = 0; i < keys.length; i++) {
  2330. defineReactive$$1(obj, keys[i]);
  2331. }
  2332. };
  2333. /**
  2334. * Observe a list of Array items.
  2335. */
  2336. Observer.prototype.observeArray = function observeArray (items) {
  2337. for (var i = 0, l = items.length; i < l; i++) {
  2338. observe(items[i]);
  2339. }
  2340. };
  2341. // helpers
  2342. /**
  2343. * Augment a target Object or Array by intercepting
  2344. * the prototype chain using __proto__
  2345. */
  2346. function protoAugment (target, src) {
  2347. /* eslint-disable no-proto */
  2348. target.__proto__ = src;
  2349. /* eslint-enable no-proto */
  2350. }
  2351. /**
  2352. * Augment a target Object or Array by defining
  2353. * hidden properties.
  2354. */
  2355. /* istanbul ignore next */
  2356. function copyAugment (target, src, keys) {
  2357. for (var i = 0, l = keys.length; i < l; i++) {
  2358. var key = keys[i];
  2359. def(target, key, src[key]);
  2360. }
  2361. }
  2362. /**
  2363. * Attempt to create an observer instance for a value,
  2364. * returns the new observer if successfully observed,
  2365. * or the existing observer if the value already has one.
  2366. */
  2367. function observe (value, asRootData) {
  2368. if (!isObject(value) || value instanceof VNode) {
  2369. return
  2370. }
  2371. var ob;
  2372. if (hasOwn(value, '__ob__') && value.__ob__ instanceof Observer) {
  2373. ob = value.__ob__;
  2374. } else if (
  2375. shouldObserve &&
  2376. !isServerRendering() &&
  2377. (Array.isArray(value) || isPlainObject(value)) &&
  2378. Object.isExtensible(value) &&
  2379. !value._isVue
  2380. ) {
  2381. ob = new Observer(value);
  2382. }
  2383. if (asRootData && ob) {
  2384. ob.vmCount++;
  2385. }
  2386. return ob
  2387. }
  2388. /**
  2389. * Define a reactive property on an Object.
  2390. */
  2391. function defineReactive$$1 (
  2392. obj,
  2393. key,
  2394. val,
  2395. customSetter,
  2396. shallow
  2397. ) {
  2398. var dep = new Dep();
  2399. var property = Object.getOwnPropertyDescriptor(obj, key);
  2400. if (property && property.configurable === false) {
  2401. return
  2402. }
  2403. // cater for pre-defined getter/setters
  2404. var getter = property && property.get;
  2405. var setter = property && property.set;
  2406. if ((!getter || setter) && arguments.length === 2) {
  2407. val = obj[key];
  2408. }
  2409. var childOb = !shallow && observe(val);
  2410. Object.defineProperty(obj, key, {
  2411. enumerable: true,
  2412. configurable: true,
  2413. get: function reactiveGetter () {
  2414. var value = getter ? getter.call(obj) : val;
  2415. if (Dep.SharedObject.target) { // fixed by xxxxxx
  2416. dep.depend();
  2417. if (childOb) {
  2418. childOb.dep.depend();
  2419. if (Array.isArray(value)) {
  2420. dependArray(value);
  2421. }
  2422. }
  2423. }
  2424. return value
  2425. },
  2426. set: function reactiveSetter (newVal) {
  2427. var value = getter ? getter.call(obj) : val;
  2428. /* eslint-disable no-self-compare */
  2429. if (newVal === value || (newVal !== newVal && value !== value)) {
  2430. return
  2431. }
  2432. /* eslint-enable no-self-compare */
  2433. if ( true && customSetter) {
  2434. customSetter();
  2435. }
  2436. // #7981: for accessor properties without setter
  2437. if (getter && !setter) { return }
  2438. if (setter) {
  2439. setter.call(obj, newVal);
  2440. } else {
  2441. val = newVal;
  2442. }
  2443. childOb = !shallow && observe(newVal);
  2444. dep.notify();
  2445. }
  2446. });
  2447. }
  2448. /**
  2449. * Set a property on an object. Adds the new property and
  2450. * triggers change notification if the property doesn't
  2451. * already exist.
  2452. */
  2453. function set (target, key, val) {
  2454. if ( true &&
  2455. (isUndef(target) || isPrimitive(target))
  2456. ) {
  2457. warn(("Cannot set reactive property on undefined, null, or primitive value: " + ((target))));
  2458. }
  2459. if (Array.isArray(target) && isValidArrayIndex(key)) {
  2460. target.length = Math.max(target.length, key);
  2461. target.splice(key, 1, val);
  2462. return val
  2463. }
  2464. if (key in target && !(key in Object.prototype)) {
  2465. target[key] = val;
  2466. return val
  2467. }
  2468. var ob = (target).__ob__;
  2469. if (target._isVue || (ob && ob.vmCount)) {
  2470. true && warn(
  2471. 'Avoid adding reactive properties to a Vue instance or its root $data ' +
  2472. 'at runtime - declare it upfront in the data option.'
  2473. );
  2474. return val
  2475. }
  2476. if (!ob) {
  2477. target[key] = val;
  2478. return val
  2479. }
  2480. defineReactive$$1(ob.value, key, val);
  2481. ob.dep.notify();
  2482. return val
  2483. }
  2484. /**
  2485. * Delete a property and trigger change if necessary.
  2486. */
  2487. function del (target, key) {
  2488. if ( true &&
  2489. (isUndef(target) || isPrimitive(target))
  2490. ) {
  2491. warn(("Cannot delete reactive property on undefined, null, or primitive value: " + ((target))));
  2492. }
  2493. if (Array.isArray(target) && isValidArrayIndex(key)) {
  2494. target.splice(key, 1);
  2495. return
  2496. }
  2497. var ob = (target).__ob__;
  2498. if (target._isVue || (ob && ob.vmCount)) {
  2499. true && warn(
  2500. 'Avoid deleting properties on a Vue instance or its root $data ' +
  2501. '- just set it to null.'
  2502. );
  2503. return
  2504. }
  2505. if (!hasOwn(target, key)) {
  2506. return
  2507. }
  2508. delete target[key];
  2509. if (!ob) {
  2510. return
  2511. }
  2512. ob.dep.notify();
  2513. }
  2514. /**
  2515. * Collect dependencies on array elements when the array is touched, since
  2516. * we cannot intercept array element access like property getters.
  2517. */
  2518. function dependArray (value) {
  2519. for (var e = (void 0), i = 0, l = value.length; i < l; i++) {
  2520. e = value[i];
  2521. e && e.__ob__ && e.__ob__.dep.depend();
  2522. if (Array.isArray(e)) {
  2523. dependArray(e);
  2524. }
  2525. }
  2526. }
  2527. /* */
  2528. /**
  2529. * Option overwriting strategies are functions that handle
  2530. * how to merge a parent option value and a child option
  2531. * value into the final value.
  2532. */
  2533. var strats = config.optionMergeStrategies;
  2534. /**
  2535. * Options with restrictions
  2536. */
  2537. if (true) {
  2538. strats.el = strats.propsData = function (parent, child, vm, key) {
  2539. if (!vm) {
  2540. warn(
  2541. "option \"" + key + "\" can only be used during instance " +
  2542. 'creation with the `new` keyword.'
  2543. );
  2544. }
  2545. return defaultStrat(parent, child)
  2546. };
  2547. }
  2548. /**
  2549. * Helper that recursively merges two data objects together.
  2550. */
  2551. function mergeData (to, from) {
  2552. if (!from) { return to }
  2553. var key, toVal, fromVal;
  2554. var keys = hasSymbol
  2555. ? Reflect.ownKeys(from)
  2556. : Object.keys(from);
  2557. for (var i = 0; i < keys.length; i++) {
  2558. key = keys[i];
  2559. // in case the object is already observed...
  2560. if (key === '__ob__') { continue }
  2561. toVal = to[key];
  2562. fromVal = from[key];
  2563. if (!hasOwn(to, key)) {
  2564. set(to, key, fromVal);
  2565. } else if (
  2566. toVal !== fromVal &&
  2567. isPlainObject(toVal) &&
  2568. isPlainObject(fromVal)
  2569. ) {
  2570. mergeData(toVal, fromVal);
  2571. }
  2572. }
  2573. return to
  2574. }
  2575. /**
  2576. * Data
  2577. */
  2578. function mergeDataOrFn (
  2579. parentVal,
  2580. childVal,
  2581. vm
  2582. ) {
  2583. if (!vm) {
  2584. // in a Vue.extend merge, both should be functions
  2585. if (!childVal) {
  2586. return parentVal
  2587. }
  2588. if (!parentVal) {
  2589. return childVal
  2590. }
  2591. // when parentVal & childVal are both present,
  2592. // we need to return a function that returns the
  2593. // merged result of both functions... no need to
  2594. // check if parentVal is a function here because
  2595. // it has to be a function to pass previous merges.
  2596. return function mergedDataFn () {
  2597. return mergeData(
  2598. typeof childVal === 'function' ? childVal.call(this, this) : childVal,
  2599. typeof parentVal === 'function' ? parentVal.call(this, this) : parentVal
  2600. )
  2601. }
  2602. } else {
  2603. return function mergedInstanceDataFn () {
  2604. // instance merge
  2605. var instanceData = typeof childVal === 'function'
  2606. ? childVal.call(vm, vm)
  2607. : childVal;
  2608. var defaultData = typeof parentVal === 'function'
  2609. ? parentVal.call(vm, vm)
  2610. : parentVal;
  2611. if (instanceData) {
  2612. return mergeData(instanceData, defaultData)
  2613. } else {
  2614. return defaultData
  2615. }
  2616. }
  2617. }
  2618. }
  2619. strats.data = function (
  2620. parentVal,
  2621. childVal,
  2622. vm
  2623. ) {
  2624. if (!vm) {
  2625. if (childVal && typeof childVal !== 'function') {
  2626. true && warn(
  2627. 'The "data" option should be a function ' +
  2628. 'that returns a per-instance value in component ' +
  2629. 'definitions.',
  2630. vm
  2631. );
  2632. return parentVal
  2633. }
  2634. return mergeDataOrFn(parentVal, childVal)
  2635. }
  2636. return mergeDataOrFn(parentVal, childVal, vm)
  2637. };
  2638. /**
  2639. * Hooks and props are merged as arrays.
  2640. */
  2641. function mergeHook (
  2642. parentVal,
  2643. childVal
  2644. ) {
  2645. var res = childVal
  2646. ? parentVal
  2647. ? parentVal.concat(childVal)
  2648. : Array.isArray(childVal)
  2649. ? childVal
  2650. : [childVal]
  2651. : parentVal;
  2652. return res
  2653. ? dedupeHooks(res)
  2654. : res
  2655. }
  2656. function dedupeHooks (hooks) {
  2657. var res = [];
  2658. for (var i = 0; i < hooks.length; i++) {
  2659. if (res.indexOf(hooks[i]) === -1) {
  2660. res.push(hooks[i]);
  2661. }
  2662. }
  2663. return res
  2664. }
  2665. LIFECYCLE_HOOKS.forEach(function (hook) {
  2666. strats[hook] = mergeHook;
  2667. });
  2668. /**
  2669. * Assets
  2670. *
  2671. * When a vm is present (instance creation), we need to do
  2672. * a three-way merge between constructor options, instance
  2673. * options and parent options.
  2674. */
  2675. function mergeAssets (
  2676. parentVal,
  2677. childVal,
  2678. vm,
  2679. key
  2680. ) {
  2681. var res = Object.create(parentVal || null);
  2682. if (childVal) {
  2683. true && assertObjectType(key, childVal, vm);
  2684. return extend(res, childVal)
  2685. } else {
  2686. return res
  2687. }
  2688. }
  2689. ASSET_TYPES.forEach(function (type) {
  2690. strats[type + 's'] = mergeAssets;
  2691. });
  2692. /**
  2693. * Watchers.
  2694. *
  2695. * Watchers hashes should not overwrite one
  2696. * another, so we merge them as arrays.
  2697. */
  2698. strats.watch = function (
  2699. parentVal,
  2700. childVal,
  2701. vm,
  2702. key
  2703. ) {
  2704. // work around Firefox's Object.prototype.watch...
  2705. if (parentVal === nativeWatch) { parentVal = undefined; }
  2706. if (childVal === nativeWatch) { childVal = undefined; }
  2707. /* istanbul ignore if */
  2708. if (!childVal) { return Object.create(parentVal || null) }
  2709. if (true) {
  2710. assertObjectType(key, childVal, vm);
  2711. }
  2712. if (!parentVal) { return childVal }
  2713. var ret = {};
  2714. extend(ret, parentVal);
  2715. for (var key$1 in childVal) {
  2716. var parent = ret[key$1];
  2717. var child = childVal[key$1];
  2718. if (parent && !Array.isArray(parent)) {
  2719. parent = [parent];
  2720. }
  2721. ret[key$1] = parent
  2722. ? parent.concat(child)
  2723. : Array.isArray(child) ? child : [child];
  2724. }
  2725. return ret
  2726. };
  2727. /**
  2728. * Other object hashes.
  2729. */
  2730. strats.props =
  2731. strats.methods =
  2732. strats.inject =
  2733. strats.computed = function (
  2734. parentVal,
  2735. childVal,
  2736. vm,
  2737. key
  2738. ) {
  2739. if (childVal && "development" !== 'production') {
  2740. assertObjectType(key, childVal, vm);
  2741. }
  2742. if (!parentVal) { return childVal }
  2743. var ret = Object.create(null);
  2744. extend(ret, parentVal);
  2745. if (childVal) { extend(ret, childVal); }
  2746. return ret
  2747. };
  2748. strats.provide = mergeDataOrFn;
  2749. /**
  2750. * Default strategy.
  2751. */
  2752. var defaultStrat = function (parentVal, childVal) {
  2753. return childVal === undefined
  2754. ? parentVal
  2755. : childVal
  2756. };
  2757. /**
  2758. * Validate component names
  2759. */
  2760. function checkComponents (options) {
  2761. for (var key in options.components) {
  2762. validateComponentName(key);
  2763. }
  2764. }
  2765. function validateComponentName (name) {
  2766. if (!new RegExp(("^[a-zA-Z][\\-\\.0-9_" + (unicodeRegExp.source) + "]*$")).test(name)) {
  2767. warn(
  2768. 'Invalid component name: "' + name + '". Component names ' +
  2769. 'should conform to valid custom element name in html5 specification.'
  2770. );
  2771. }
  2772. if (isBuiltInTag(name) || config.isReservedTag(name)) {
  2773. warn(
  2774. 'Do not use built-in or reserved HTML elements as component ' +
  2775. 'id: ' + name
  2776. );
  2777. }
  2778. }
  2779. /**
  2780. * Ensure all props option syntax are normalized into the
  2781. * Object-based format.
  2782. */
  2783. function normalizeProps (options, vm) {
  2784. var props = options.props;
  2785. if (!props) { return }
  2786. var res = {};
  2787. var i, val, name;
  2788. if (Array.isArray(props)) {
  2789. i = props.length;
  2790. while (i--) {
  2791. val = props[i];
  2792. if (typeof val === 'string') {
  2793. name = camelize(val);
  2794. res[name] = { type: null };
  2795. } else if (true) {
  2796. warn('props must be strings when using array syntax.');
  2797. }
  2798. }
  2799. } else if (isPlainObject(props)) {
  2800. for (var key in props) {
  2801. val = props[key];
  2802. name = camelize(key);
  2803. res[name] = isPlainObject(val)
  2804. ? val
  2805. : { type: val };
  2806. }
  2807. } else if (true) {
  2808. warn(
  2809. "Invalid value for option \"props\": expected an Array or an Object, " +
  2810. "but got " + (toRawType(props)) + ".",
  2811. vm
  2812. );
  2813. }
  2814. options.props = res;
  2815. }
  2816. /**
  2817. * Normalize all injections into Object-based format
  2818. */
  2819. function normalizeInject (options, vm) {
  2820. var inject = options.inject;
  2821. if (!inject) { return }
  2822. var normalized = options.inject = {};
  2823. if (Array.isArray(inject)) {
  2824. for (var i = 0; i < inject.length; i++) {
  2825. normalized[inject[i]] = { from: inject[i] };
  2826. }
  2827. } else if (isPlainObject(inject)) {
  2828. for (var key in inject) {
  2829. var val = inject[key];
  2830. normalized[key] = isPlainObject(val)
  2831. ? extend({ from: key }, val)
  2832. : { from: val };
  2833. }
  2834. } else if (true) {
  2835. warn(
  2836. "Invalid value for option \"inject\": expected an Array or an Object, " +
  2837. "but got " + (toRawType(inject)) + ".",
  2838. vm
  2839. );
  2840. }
  2841. }
  2842. /**
  2843. * Normalize raw function directives into object format.
  2844. */
  2845. function normalizeDirectives (options) {
  2846. var dirs = options.directives;
  2847. if (dirs) {
  2848. for (var key in dirs) {
  2849. var def$$1 = dirs[key];
  2850. if (typeof def$$1 === 'function') {
  2851. dirs[key] = { bind: def$$1, update: def$$1 };
  2852. }
  2853. }
  2854. }
  2855. }
  2856. function assertObjectType (name, value, vm) {
  2857. if (!isPlainObject(value)) {
  2858. warn(
  2859. "Invalid value for option \"" + name + "\": expected an Object, " +
  2860. "but got " + (toRawType(value)) + ".",
  2861. vm
  2862. );
  2863. }
  2864. }
  2865. /**
  2866. * Merge two option objects into a new one.
  2867. * Core utility used in both instantiation and inheritance.
  2868. */
  2869. function mergeOptions (
  2870. parent,
  2871. child,
  2872. vm
  2873. ) {
  2874. if (true) {
  2875. checkComponents(child);
  2876. }
  2877. if (typeof child === 'function') {
  2878. child = child.options;
  2879. }
  2880. normalizeProps(child, vm);
  2881. normalizeInject(child, vm);
  2882. normalizeDirectives(child);
  2883. // Apply extends and mixins on the child options,
  2884. // but only if it is a raw options object that isn't
  2885. // the result of another mergeOptions call.
  2886. // Only merged options has the _base property.
  2887. if (!child._base) {
  2888. if (child.extends) {
  2889. parent = mergeOptions(parent, child.extends, vm);
  2890. }
  2891. if (child.mixins) {
  2892. for (var i = 0, l = child.mixins.length; i < l; i++) {
  2893. parent = mergeOptions(parent, child.mixins[i], vm);
  2894. }
  2895. }
  2896. }
  2897. var options = {};
  2898. var key;
  2899. for (key in parent) {
  2900. mergeField(key);
  2901. }
  2902. for (key in child) {
  2903. if (!hasOwn(parent, key)) {
  2904. mergeField(key);
  2905. }
  2906. }
  2907. function mergeField (key) {
  2908. var strat = strats[key] || defaultStrat;
  2909. options[key] = strat(parent[key], child[key], vm, key);
  2910. }
  2911. return options
  2912. }
  2913. /**
  2914. * Resolve an asset.
  2915. * This function is used because child instances need access
  2916. * to assets defined in its ancestor chain.
  2917. */
  2918. function resolveAsset (
  2919. options,
  2920. type,
  2921. id,
  2922. warnMissing
  2923. ) {
  2924. /* istanbul ignore if */
  2925. if (typeof id !== 'string') {
  2926. return
  2927. }
  2928. var assets = options[type];
  2929. // check local registration variations first
  2930. if (hasOwn(assets, id)) { return assets[id] }
  2931. var camelizedId = camelize(id);
  2932. if (hasOwn(assets, camelizedId)) { return assets[camelizedId] }
  2933. var PascalCaseId = capitalize(camelizedId);
  2934. if (hasOwn(assets, PascalCaseId)) { return assets[PascalCaseId] }
  2935. // fallback to prototype chain
  2936. var res = assets[id] || assets[camelizedId] || assets[PascalCaseId];
  2937. if ( true && warnMissing && !res) {
  2938. warn(
  2939. 'Failed to resolve ' + type.slice(0, -1) + ': ' + id,
  2940. options
  2941. );
  2942. }
  2943. return res
  2944. }
  2945. /* */
  2946. function validateProp (
  2947. key,
  2948. propOptions,
  2949. propsData,
  2950. vm
  2951. ) {
  2952. var prop = propOptions[key];
  2953. var absent = !hasOwn(propsData, key);
  2954. var value = propsData[key];
  2955. // boolean casting
  2956. var booleanIndex = getTypeIndex(Boolean, prop.type);
  2957. if (booleanIndex > -1) {
  2958. if (absent && !hasOwn(prop, 'default')) {
  2959. value = false;
  2960. } else if (value === '' || value === hyphenate(key)) {
  2961. // only cast empty string / same name to boolean if
  2962. // boolean has higher priority
  2963. var stringIndex = getTypeIndex(String, prop.type);
  2964. if (stringIndex < 0 || booleanIndex < stringIndex) {
  2965. value = true;
  2966. }
  2967. }
  2968. }
  2969. // check default value
  2970. if (value === undefined) {
  2971. value = getPropDefaultValue(vm, prop, key);
  2972. // since the default value is a fresh copy,
  2973. // make sure to observe it.
  2974. var prevShouldObserve = shouldObserve;
  2975. toggleObserving(true);
  2976. observe(value);
  2977. toggleObserving(prevShouldObserve);
  2978. }
  2979. if (
  2980. true
  2981. ) {
  2982. assertProp(prop, key, value, vm, absent);
  2983. }
  2984. return value
  2985. }
  2986. /**
  2987. * Get the default value of a prop.
  2988. */
  2989. function getPropDefaultValue (vm, prop, key) {
  2990. // no default, return undefined
  2991. if (!hasOwn(prop, 'default')) {
  2992. return undefined
  2993. }
  2994. var def = prop.default;
  2995. // warn against non-factory defaults for Object & Array
  2996. if ( true && isObject(def)) {
  2997. warn(
  2998. 'Invalid default value for prop "' + key + '": ' +
  2999. 'Props with type Object/Array must use a factory function ' +
  3000. 'to return the default value.',
  3001. vm
  3002. );
  3003. }
  3004. // the raw prop value was also undefined from previous render,
  3005. // return previous default value to avoid unnecessary watcher trigger
  3006. if (vm && vm.$options.propsData &&
  3007. vm.$options.propsData[key] === undefined &&
  3008. vm._props[key] !== undefined
  3009. ) {
  3010. return vm._props[key]
  3011. }
  3012. // call factory function for non-Function types
  3013. // a value is Function if its prototype is function even across different execution context
  3014. return typeof def === 'function' && getType(prop.type) !== 'Function'
  3015. ? def.call(vm)
  3016. : def
  3017. }
  3018. /**
  3019. * Assert whether a prop is valid.
  3020. */
  3021. function assertProp (
  3022. prop,
  3023. name,
  3024. value,
  3025. vm,
  3026. absent
  3027. ) {
  3028. if (prop.required && absent) {
  3029. warn(
  3030. 'Missing required prop: "' + name + '"',
  3031. vm
  3032. );
  3033. return
  3034. }
  3035. if (value == null && !prop.required) {
  3036. return
  3037. }
  3038. var type = prop.type;
  3039. var valid = !type || type === true;
  3040. var expectedTypes = [];
  3041. if (type) {
  3042. if (!Array.isArray(type)) {
  3043. type = [type];
  3044. }
  3045. for (var i = 0; i < type.length && !valid; i++) {
  3046. var assertedType = assertType(value, type[i]);
  3047. expectedTypes.push(assertedType.expectedType || '');
  3048. valid = assertedType.valid;
  3049. }
  3050. }
  3051. if (!valid) {
  3052. warn(
  3053. getInvalidTypeMessage(name, value, expectedTypes),
  3054. vm
  3055. );
  3056. return
  3057. }
  3058. var validator = prop.validator;
  3059. if (validator) {
  3060. if (!validator(value)) {
  3061. warn(
  3062. 'Invalid prop: custom validator check failed for prop "' + name + '".',
  3063. vm
  3064. );
  3065. }
  3066. }
  3067. }
  3068. var simpleCheckRE = /^(String|Number|Boolean|Function|Symbol)$/;
  3069. function assertType (value, type) {
  3070. var valid;
  3071. var expectedType = getType(type);
  3072. if (simpleCheckRE.test(expectedType)) {
  3073. var t = typeof value;
  3074. valid = t === expectedType.toLowerCase();
  3075. // for primitive wrapper objects
  3076. if (!valid && t === 'object') {
  3077. valid = value instanceof type;
  3078. }
  3079. } else if (expectedType === 'Object') {
  3080. valid = isPlainObject(value);
  3081. } else if (expectedType === 'Array') {
  3082. valid = Array.isArray(value);
  3083. } else {
  3084. valid = value instanceof type;
  3085. }
  3086. return {
  3087. valid: valid,
  3088. expectedType: expectedType
  3089. }
  3090. }
  3091. /**
  3092. * Use function string name to check built-in types,
  3093. * because a simple equality check will fail when running
  3094. * across different vms / iframes.
  3095. */
  3096. function getType (fn) {
  3097. var match = fn && fn.toString().match(/^\s*function (\w+)/);
  3098. return match ? match[1] : ''
  3099. }
  3100. function isSameType (a, b) {
  3101. return getType(a) === getType(b)
  3102. }
  3103. function getTypeIndex (type, expectedTypes) {
  3104. if (!Array.isArray(expectedTypes)) {
  3105. return isSameType(expectedTypes, type) ? 0 : -1
  3106. }
  3107. for (var i = 0, len = expectedTypes.length; i < len; i++) {
  3108. if (isSameType(expectedTypes[i], type)) {
  3109. return i
  3110. }
  3111. }
  3112. return -1
  3113. }
  3114. function getInvalidTypeMessage (name, value, expectedTypes) {
  3115. var message = "Invalid prop: type check failed for prop \"" + name + "\"." +
  3116. " Expected " + (expectedTypes.map(capitalize).join(', '));
  3117. var expectedType = expectedTypes[0];
  3118. var receivedType = toRawType(value);
  3119. var expectedValue = styleValue(value, expectedType);
  3120. var receivedValue = styleValue(value, receivedType);
  3121. // check if we need to specify expected value
  3122. if (expectedTypes.length === 1 &&
  3123. isExplicable(expectedType) &&
  3124. !isBoolean(expectedType, receivedType)) {
  3125. message += " with value " + expectedValue;
  3126. }
  3127. message += ", got " + receivedType + " ";
  3128. // check if we need to specify received value
  3129. if (isExplicable(receivedType)) {
  3130. message += "with value " + receivedValue + ".";
  3131. }
  3132. return message
  3133. }
  3134. function styleValue (value, type) {
  3135. if (type === 'String') {
  3136. return ("\"" + value + "\"")
  3137. } else if (type === 'Number') {
  3138. return ("" + (Number(value)))
  3139. } else {
  3140. return ("" + value)
  3141. }
  3142. }
  3143. function isExplicable (value) {
  3144. var explicitTypes = ['string', 'number', 'boolean'];
  3145. return explicitTypes.some(function (elem) { return value.toLowerCase() === elem; })
  3146. }
  3147. function isBoolean () {
  3148. var args = [], len = arguments.length;
  3149. while ( len-- ) args[ len ] = arguments[ len ];
  3150. return args.some(function (elem) { return elem.toLowerCase() === 'boolean'; })
  3151. }
  3152. /* */
  3153. function handleError (err, vm, info) {
  3154. // Deactivate deps tracking while processing error handler to avoid possible infinite rendering.
  3155. // See: https://github.com/vuejs/vuex/issues/1505
  3156. pushTarget();
  3157. try {
  3158. if (vm) {
  3159. var cur = vm;
  3160. while ((cur = cur.$parent)) {
  3161. var hooks = cur.$options.errorCaptured;
  3162. if (hooks) {
  3163. for (var i = 0; i < hooks.length; i++) {
  3164. try {
  3165. var capture = hooks[i].call(cur, err, vm, info) === false;
  3166. if (capture) { return }
  3167. } catch (e) {
  3168. globalHandleError(e, cur, 'errorCaptured hook');
  3169. }
  3170. }
  3171. }
  3172. }
  3173. }
  3174. globalHandleError(err, vm, info);
  3175. } finally {
  3176. popTarget();
  3177. }
  3178. }
  3179. function invokeWithErrorHandling (
  3180. handler,
  3181. context,
  3182. args,
  3183. vm,
  3184. info
  3185. ) {
  3186. var res;
  3187. try {
  3188. res = args ? handler.apply(context, args) : handler.call(context);
  3189. if (res && !res._isVue && isPromise(res) && !res._handled) {
  3190. res.catch(function (e) { return handleError(e, vm, info + " (Promise/async)"); });
  3191. // issue #9511
  3192. // avoid catch triggering multiple times when nested calls
  3193. res._handled = true;
  3194. }
  3195. } catch (e) {
  3196. handleError(e, vm, info);
  3197. }
  3198. return res
  3199. }
  3200. function globalHandleError (err, vm, info) {
  3201. if (config.errorHandler) {
  3202. try {
  3203. return config.errorHandler.call(null, err, vm, info)
  3204. } catch (e) {
  3205. // if the user intentionally throws the original error in the handler,
  3206. // do not log it twice
  3207. if (e !== err) {
  3208. logError(e, null, 'config.errorHandler');
  3209. }
  3210. }
  3211. }
  3212. logError(err, vm, info);
  3213. }
  3214. function logError (err, vm, info) {
  3215. if (true) {
  3216. warn(("Error in " + info + ": \"" + (err.toString()) + "\""), vm);
  3217. }
  3218. /* istanbul ignore else */
  3219. if ((inBrowser || inWeex) && typeof console !== 'undefined') {
  3220. console.error(err);
  3221. } else {
  3222. throw err
  3223. }
  3224. }
  3225. /* */
  3226. var callbacks = [];
  3227. var pending = false;
  3228. function flushCallbacks () {
  3229. pending = false;
  3230. var copies = callbacks.slice(0);
  3231. callbacks.length = 0;
  3232. for (var i = 0; i < copies.length; i++) {
  3233. copies[i]();
  3234. }
  3235. }
  3236. // Here we have async deferring wrappers using microtasks.
  3237. // In 2.5 we used (macro) tasks (in combination with microtasks).
  3238. // However, it has subtle problems when state is changed right before repaint
  3239. // (e.g. #6813, out-in transitions).
  3240. // Also, using (macro) tasks in event handler would cause some weird behaviors
  3241. // that cannot be circumvented (e.g. #7109, #7153, #7546, #7834, #8109).
  3242. // So we now use microtasks everywhere, again.
  3243. // A major drawback of this tradeoff is that there are some scenarios
  3244. // where microtasks have too high a priority and fire in between supposedly
  3245. // sequential events (e.g. #4521, #6690, which have workarounds)
  3246. // or even between bubbling of the same event (#6566).
  3247. var timerFunc;
  3248. // The nextTick behavior leverages the microtask queue, which can be accessed
  3249. // via either native Promise.then or MutationObserver.
  3250. // MutationObserver has wider support, however it is seriously bugged in
  3251. // UIWebView in iOS >= 9.3.3 when triggered in touch event handlers. It
  3252. // completely stops working after triggering a few times... so, if native
  3253. // Promise is available, we will use it:
  3254. /* istanbul ignore next, $flow-disable-line */
  3255. if (typeof Promise !== 'undefined' && isNative(Promise)) {
  3256. var p = Promise.resolve();
  3257. timerFunc = function () {
  3258. p.then(flushCallbacks);
  3259. // In problematic UIWebViews, Promise.then doesn't completely break, but
  3260. // it can get stuck in a weird state where callbacks are pushed into the
  3261. // microtask queue but the queue isn't being flushed, until the browser
  3262. // needs to do some other work, e.g. handle a timer. Therefore we can
  3263. // "force" the microtask queue to be flushed by adding an empty timer.
  3264. if (isIOS) { setTimeout(noop); }
  3265. };
  3266. } else if (!isIE && typeof MutationObserver !== 'undefined' && (
  3267. isNative(MutationObserver) ||
  3268. // PhantomJS and iOS 7.x
  3269. MutationObserver.toString() === '[object MutationObserverConstructor]'
  3270. )) {
  3271. // Use MutationObserver where native Promise is not available,
  3272. // e.g. PhantomJS, iOS7, Android 4.4
  3273. // (#6466 MutationObserver is unreliable in IE11)
  3274. var counter = 1;
  3275. var observer = new MutationObserver(flushCallbacks);
  3276. var textNode = document.createTextNode(String(counter));
  3277. observer.observe(textNode, {
  3278. characterData: true
  3279. });
  3280. timerFunc = function () {
  3281. counter = (counter + 1) % 2;
  3282. textNode.data = String(counter);
  3283. };
  3284. } else if (typeof setImmediate !== 'undefined' && isNative(setImmediate)) {
  3285. // Fallback to setImmediate.
  3286. // Technically it leverages the (macro) task queue,
  3287. // but it is still a better choice than setTimeout.
  3288. timerFunc = function () {
  3289. setImmediate(flushCallbacks);
  3290. };
  3291. } else {
  3292. // Fallback to setTimeout.
  3293. timerFunc = function () {
  3294. setTimeout(flushCallbacks, 0);
  3295. };
  3296. }
  3297. function nextTick (cb, ctx) {
  3298. var _resolve;
  3299. callbacks.push(function () {
  3300. if (cb) {
  3301. try {
  3302. cb.call(ctx);
  3303. } catch (e) {
  3304. handleError(e, ctx, 'nextTick');
  3305. }
  3306. } else if (_resolve) {
  3307. _resolve(ctx);
  3308. }
  3309. });
  3310. if (!pending) {
  3311. pending = true;
  3312. timerFunc();
  3313. }
  3314. // $flow-disable-line
  3315. if (!cb && typeof Promise !== 'undefined') {
  3316. return new Promise(function (resolve) {
  3317. _resolve = resolve;
  3318. })
  3319. }
  3320. }
  3321. /* */
  3322. /* not type checking this file because flow doesn't play well with Proxy */
  3323. var initProxy;
  3324. if (true) {
  3325. var allowedGlobals = makeMap(
  3326. 'Infinity,undefined,NaN,isFinite,isNaN,' +
  3327. 'parseFloat,parseInt,decodeURI,decodeURIComponent,encodeURI,encodeURIComponent,' +
  3328. 'Math,Number,Date,Array,Object,Boolean,String,RegExp,Map,Set,JSON,Intl,' +
  3329. 'require' // for Webpack/Browserify
  3330. );
  3331. var warnNonPresent = function (target, key) {
  3332. warn(
  3333. "Property or method \"" + key + "\" is not defined on the instance but " +
  3334. 'referenced during render. Make sure that this property is reactive, ' +
  3335. 'either in the data option, or for class-based components, by ' +
  3336. 'initializing the property. ' +
  3337. 'See: https://vuejs.org/v2/guide/reactivity.html#Declaring-Reactive-Properties.',
  3338. target
  3339. );
  3340. };
  3341. var warnReservedPrefix = function (target, key) {
  3342. warn(
  3343. "Property \"" + key + "\" must be accessed with \"$data." + key + "\" because " +
  3344. 'properties starting with "$" or "_" are not proxied in the Vue instance to ' +
  3345. 'prevent conflicts with Vue internals. ' +
  3346. 'See: https://vuejs.org/v2/api/#data',
  3347. target
  3348. );
  3349. };
  3350. var hasProxy =
  3351. typeof Proxy !== 'undefined' && isNative(Proxy);
  3352. if (hasProxy) {
  3353. var isBuiltInModifier = makeMap('stop,prevent,self,ctrl,shift,alt,meta,exact');
  3354. config.keyCodes = new Proxy(config.keyCodes, {
  3355. set: function set (target, key, value) {
  3356. if (isBuiltInModifier(key)) {
  3357. warn(("Avoid overwriting built-in modifier in config.keyCodes: ." + key));
  3358. return false
  3359. } else {
  3360. target[key] = value;
  3361. return true
  3362. }
  3363. }
  3364. });
  3365. }
  3366. var hasHandler = {
  3367. has: function has (target, key) {
  3368. var has = key in target;
  3369. var isAllowed = allowedGlobals(key) ||
  3370. (typeof key === 'string' && key.charAt(0) === '_' && !(key in target.$data));
  3371. if (!has && !isAllowed) {
  3372. if (key in target.$data) { warnReservedPrefix(target, key); }
  3373. else { warnNonPresent(target, key); }
  3374. }
  3375. return has || !isAllowed
  3376. }
  3377. };
  3378. var getHandler = {
  3379. get: function get (target, key) {
  3380. if (typeof key === 'string' && !(key in target)) {
  3381. if (key in target.$data) { warnReservedPrefix(target, key); }
  3382. else { warnNonPresent(target, key); }
  3383. }
  3384. return target[key]
  3385. }
  3386. };
  3387. initProxy = function initProxy (vm) {
  3388. if (hasProxy) {
  3389. // determine which proxy handler to use
  3390. var options = vm.$options;
  3391. var handlers = options.render && options.render._withStripped
  3392. ? getHandler
  3393. : hasHandler;
  3394. vm._renderProxy = new Proxy(vm, handlers);
  3395. } else {
  3396. vm._renderProxy = vm;
  3397. }
  3398. };
  3399. }
  3400. /* */
  3401. var seenObjects = new _Set();
  3402. /**
  3403. * Recursively traverse an object to evoke all converted
  3404. * getters, so that every nested property inside the object
  3405. * is collected as a "deep" dependency.
  3406. */
  3407. function traverse (val) {
  3408. _traverse(val, seenObjects);
  3409. seenObjects.clear();
  3410. }
  3411. function _traverse (val, seen) {
  3412. var i, keys;
  3413. var isA = Array.isArray(val);
  3414. if ((!isA && !isObject(val)) || Object.isFrozen(val) || val instanceof VNode) {
  3415. return
  3416. }
  3417. if (val.__ob__) {
  3418. var depId = val.__ob__.dep.id;
  3419. if (seen.has(depId)) {
  3420. return
  3421. }
  3422. seen.add(depId);
  3423. }
  3424. if (isA) {
  3425. i = val.length;
  3426. while (i--) { _traverse(val[i], seen); }
  3427. } else {
  3428. keys = Object.keys(val);
  3429. i = keys.length;
  3430. while (i--) { _traverse(val[keys[i]], seen); }
  3431. }
  3432. }
  3433. var mark;
  3434. var measure;
  3435. if (true) {
  3436. var perf = inBrowser && window.performance;
  3437. /* istanbul ignore if */
  3438. if (
  3439. perf &&
  3440. perf.mark &&
  3441. perf.measure &&
  3442. perf.clearMarks &&
  3443. perf.clearMeasures
  3444. ) {
  3445. mark = function (tag) { return perf.mark(tag); };
  3446. measure = function (name, startTag, endTag) {
  3447. perf.measure(name, startTag, endTag);
  3448. perf.clearMarks(startTag);
  3449. perf.clearMarks(endTag);
  3450. // perf.clearMeasures(name)
  3451. };
  3452. }
  3453. }
  3454. /* */
  3455. var normalizeEvent = cached(function (name) {
  3456. var passive = name.charAt(0) === '&';
  3457. name = passive ? name.slice(1) : name;
  3458. var once$$1 = name.charAt(0) === '~'; // Prefixed last, checked first
  3459. name = once$$1 ? name.slice(1) : name;
  3460. var capture = name.charAt(0) === '!';
  3461. name = capture ? name.slice(1) : name;
  3462. return {
  3463. name: name,
  3464. once: once$$1,
  3465. capture: capture,
  3466. passive: passive
  3467. }
  3468. });
  3469. function createFnInvoker (fns, vm) {
  3470. function invoker () {
  3471. var arguments$1 = arguments;
  3472. var fns = invoker.fns;
  3473. if (Array.isArray(fns)) {
  3474. var cloned = fns.slice();
  3475. for (var i = 0; i < cloned.length; i++) {
  3476. invokeWithErrorHandling(cloned[i], null, arguments$1, vm, "v-on handler");
  3477. }
  3478. } else {
  3479. // return handler return value for single handlers
  3480. return invokeWithErrorHandling(fns, null, arguments, vm, "v-on handler")
  3481. }
  3482. }
  3483. invoker.fns = fns;
  3484. return invoker
  3485. }
  3486. function updateListeners (
  3487. on,
  3488. oldOn,
  3489. add,
  3490. remove$$1,
  3491. createOnceHandler,
  3492. vm
  3493. ) {
  3494. var name, def$$1, cur, old, event;
  3495. for (name in on) {
  3496. def$$1 = cur = on[name];
  3497. old = oldOn[name];
  3498. event = normalizeEvent(name);
  3499. if (isUndef(cur)) {
  3500. true && warn(
  3501. "Invalid handler for event \"" + (event.name) + "\": got " + String(cur),
  3502. vm
  3503. );
  3504. } else if (isUndef(old)) {
  3505. if (isUndef(cur.fns)) {
  3506. cur = on[name] = createFnInvoker(cur, vm);
  3507. }
  3508. if (isTrue(event.once)) {
  3509. cur = on[name] = createOnceHandler(event.name, cur, event.capture);
  3510. }
  3511. add(event.name, cur, event.capture, event.passive, event.params);
  3512. } else if (cur !== old) {
  3513. old.fns = cur;
  3514. on[name] = old;
  3515. }
  3516. }
  3517. for (name in oldOn) {
  3518. if (isUndef(on[name])) {
  3519. event = normalizeEvent(name);
  3520. remove$$1(event.name, oldOn[name], event.capture);
  3521. }
  3522. }
  3523. }
  3524. /* */
  3525. /* */
  3526. // fixed by xxxxxx (mp properties)
  3527. function extractPropertiesFromVNodeData(data, Ctor, res, context) {
  3528. var propOptions = Ctor.options.mpOptions && Ctor.options.mpOptions.properties;
  3529. if (isUndef(propOptions)) {
  3530. return res
  3531. }
  3532. var externalClasses = Ctor.options.mpOptions.externalClasses || [];
  3533. var attrs = data.attrs;
  3534. var props = data.props;
  3535. if (isDef(attrs) || isDef(props)) {
  3536. for (var key in propOptions) {
  3537. var altKey = hyphenate(key);
  3538. var result = checkProp(res, props, key, altKey, true) ||
  3539. checkProp(res, attrs, key, altKey, false);
  3540. // externalClass
  3541. if (
  3542. result &&
  3543. res[key] &&
  3544. externalClasses.indexOf(altKey) !== -1 &&
  3545. context[camelize(res[key])]
  3546. ) {
  3547. // 赋值 externalClass 真正的值(模板里 externalClass 的值可能是字符串)
  3548. res[key] = context[camelize(res[key])];
  3549. }
  3550. }
  3551. }
  3552. return res
  3553. }
  3554. function extractPropsFromVNodeData (
  3555. data,
  3556. Ctor,
  3557. tag,
  3558. context// fixed by xxxxxx
  3559. ) {
  3560. // we are only extracting raw values here.
  3561. // validation and default values are handled in the child
  3562. // component itself.
  3563. var propOptions = Ctor.options.props;
  3564. if (isUndef(propOptions)) {
  3565. // fixed by xxxxxx
  3566. return extractPropertiesFromVNodeData(data, Ctor, {}, context)
  3567. }
  3568. var res = {};
  3569. var attrs = data.attrs;
  3570. var props = data.props;
  3571. if (isDef(attrs) || isDef(props)) {
  3572. for (var key in propOptions) {
  3573. var altKey = hyphenate(key);
  3574. if (true) {
  3575. var keyInLowerCase = key.toLowerCase();
  3576. if (
  3577. key !== keyInLowerCase &&
  3578. attrs && hasOwn(attrs, keyInLowerCase)
  3579. ) {
  3580. tip(
  3581. "Prop \"" + keyInLowerCase + "\" is passed to component " +
  3582. (formatComponentName(tag || Ctor)) + ", but the declared prop name is" +
  3583. " \"" + key + "\". " +
  3584. "Note that HTML attributes are case-insensitive and camelCased " +
  3585. "props need to use their kebab-case equivalents when using in-DOM " +
  3586. "templates. You should probably use \"" + altKey + "\" instead of \"" + key + "\"."
  3587. );
  3588. }
  3589. }
  3590. checkProp(res, props, key, altKey, true) ||
  3591. checkProp(res, attrs, key, altKey, false);
  3592. }
  3593. }
  3594. // fixed by xxxxxx
  3595. return extractPropertiesFromVNodeData(data, Ctor, res, context)
  3596. }
  3597. function checkProp (
  3598. res,
  3599. hash,
  3600. key,
  3601. altKey,
  3602. preserve
  3603. ) {
  3604. if (isDef(hash)) {
  3605. if (hasOwn(hash, key)) {
  3606. res[key] = hash[key];
  3607. if (!preserve) {
  3608. delete hash[key];
  3609. }
  3610. return true
  3611. } else if (hasOwn(hash, altKey)) {
  3612. res[key] = hash[altKey];
  3613. if (!preserve) {
  3614. delete hash[altKey];
  3615. }
  3616. return true
  3617. }
  3618. }
  3619. return false
  3620. }
  3621. /* */
  3622. // The template compiler attempts to minimize the need for normalization by
  3623. // statically analyzing the template at compile time.
  3624. //
  3625. // For plain HTML markup, normalization can be completely skipped because the
  3626. // generated render function is guaranteed to return Array<VNode>. There are
  3627. // two cases where extra normalization is needed:
  3628. // 1. When the children contains components - because a functional component
  3629. // may return an Array instead of a single root. In this case, just a simple
  3630. // normalization is needed - if any child is an Array, we flatten the whole
  3631. // thing with Array.prototype.concat. It is guaranteed to be only 1-level deep
  3632. // because functional components already normalize their own children.
  3633. function simpleNormalizeChildren (children) {
  3634. for (var i = 0; i < children.length; i++) {
  3635. if (Array.isArray(children[i])) {
  3636. return Array.prototype.concat.apply([], children)
  3637. }
  3638. }
  3639. return children
  3640. }
  3641. // 2. When the children contains constructs that always generated nested Arrays,
  3642. // e.g. <template>, <slot>, v-for, or when the children is provided by user
  3643. // with hand-written render functions / JSX. In such cases a full normalization
  3644. // is needed to cater to all possible types of children values.
  3645. function normalizeChildren (children) {
  3646. return isPrimitive(children)
  3647. ? [createTextVNode(children)]
  3648. : Array.isArray(children)
  3649. ? normalizeArrayChildren(children)
  3650. : undefined
  3651. }
  3652. function isTextNode (node) {
  3653. return isDef(node) && isDef(node.text) && isFalse(node.isComment)
  3654. }
  3655. function normalizeArrayChildren (children, nestedIndex) {
  3656. var res = [];
  3657. var i, c, lastIndex, last;
  3658. for (i = 0; i < children.length; i++) {
  3659. c = children[i];
  3660. if (isUndef(c) || typeof c === 'boolean') { continue }
  3661. lastIndex = res.length - 1;
  3662. last = res[lastIndex];
  3663. // nested
  3664. if (Array.isArray(c)) {
  3665. if (c.length > 0) {
  3666. c = normalizeArrayChildren(c, ((nestedIndex || '') + "_" + i));
  3667. // merge adjacent text nodes
  3668. if (isTextNode(c[0]) && isTextNode(last)) {
  3669. res[lastIndex] = createTextVNode(last.text + (c[0]).text);
  3670. c.shift();
  3671. }
  3672. res.push.apply(res, c);
  3673. }
  3674. } else if (isPrimitive(c)) {
  3675. if (isTextNode(last)) {
  3676. // merge adjacent text nodes
  3677. // this is necessary for SSR hydration because text nodes are
  3678. // essentially merged when rendered to HTML strings
  3679. res[lastIndex] = createTextVNode(last.text + c);
  3680. } else if (c !== '') {
  3681. // convert primitive to vnode
  3682. res.push(createTextVNode(c));
  3683. }
  3684. } else {
  3685. if (isTextNode(c) && isTextNode(last)) {
  3686. // merge adjacent text nodes
  3687. res[lastIndex] = createTextVNode(last.text + c.text);
  3688. } else {
  3689. // default key for nested array children (likely generated by v-for)
  3690. if (isTrue(children._isVList) &&
  3691. isDef(c.tag) &&
  3692. isUndef(c.key) &&
  3693. isDef(nestedIndex)) {
  3694. c.key = "__vlist" + nestedIndex + "_" + i + "__";
  3695. }
  3696. res.push(c);
  3697. }
  3698. }
  3699. }
  3700. return res
  3701. }
  3702. /* */
  3703. function initProvide (vm) {
  3704. var provide = vm.$options.provide;
  3705. if (provide) {
  3706. vm._provided = typeof provide === 'function'
  3707. ? provide.call(vm)
  3708. : provide;
  3709. }
  3710. }
  3711. function initInjections (vm) {
  3712. var result = resolveInject(vm.$options.inject, vm);
  3713. if (result) {
  3714. toggleObserving(false);
  3715. Object.keys(result).forEach(function (key) {
  3716. /* istanbul ignore else */
  3717. if (true) {
  3718. defineReactive$$1(vm, key, result[key], function () {
  3719. warn(
  3720. "Avoid mutating an injected value directly since the changes will be " +
  3721. "overwritten whenever the provided component re-renders. " +
  3722. "injection being mutated: \"" + key + "\"",
  3723. vm
  3724. );
  3725. });
  3726. } else {}
  3727. });
  3728. toggleObserving(true);
  3729. }
  3730. }
  3731. function resolveInject (inject, vm) {
  3732. if (inject) {
  3733. // inject is :any because flow is not smart enough to figure out cached
  3734. var result = Object.create(null);
  3735. var keys = hasSymbol
  3736. ? Reflect.ownKeys(inject)
  3737. : Object.keys(inject);
  3738. for (var i = 0; i < keys.length; i++) {
  3739. var key = keys[i];
  3740. // #6574 in case the inject object is observed...
  3741. if (key === '__ob__') { continue }
  3742. var provideKey = inject[key].from;
  3743. var source = vm;
  3744. while (source) {
  3745. if (source._provided && hasOwn(source._provided, provideKey)) {
  3746. result[key] = source._provided[provideKey];
  3747. break
  3748. }
  3749. source = source.$parent;
  3750. }
  3751. if (!source) {
  3752. if ('default' in inject[key]) {
  3753. var provideDefault = inject[key].default;
  3754. result[key] = typeof provideDefault === 'function'
  3755. ? provideDefault.call(vm)
  3756. : provideDefault;
  3757. } else if (true) {
  3758. warn(("Injection \"" + key + "\" not found"), vm);
  3759. }
  3760. }
  3761. }
  3762. return result
  3763. }
  3764. }
  3765. /* */
  3766. /**
  3767. * Runtime helper for resolving raw children VNodes into a slot object.
  3768. */
  3769. function resolveSlots (
  3770. children,
  3771. context
  3772. ) {
  3773. if (!children || !children.length) {
  3774. return {}
  3775. }
  3776. var slots = {};
  3777. for (var i = 0, l = children.length; i < l; i++) {
  3778. var child = children[i];
  3779. var data = child.data;
  3780. // remove slot attribute if the node is resolved as a Vue slot node
  3781. if (data && data.attrs && data.attrs.slot) {
  3782. delete data.attrs.slot;
  3783. }
  3784. // named slots should only be respected if the vnode was rendered in the
  3785. // same context.
  3786. if ((child.context === context || child.fnContext === context) &&
  3787. data && data.slot != null
  3788. ) {
  3789. var name = data.slot;
  3790. var slot = (slots[name] || (slots[name] = []));
  3791. if (child.tag === 'template') {
  3792. slot.push.apply(slot, child.children || []);
  3793. } else {
  3794. slot.push(child);
  3795. }
  3796. } else {
  3797. // fixed by xxxxxx 临时 hack 掉 uni-app 中的异步 name slot page
  3798. if(child.asyncMeta && child.asyncMeta.data && child.asyncMeta.data.slot === 'page'){
  3799. (slots['page'] || (slots['page'] = [])).push(child);
  3800. }else{
  3801. (slots.default || (slots.default = [])).push(child);
  3802. }
  3803. }
  3804. }
  3805. // ignore slots that contains only whitespace
  3806. for (var name$1 in slots) {
  3807. if (slots[name$1].every(isWhitespace)) {
  3808. delete slots[name$1];
  3809. }
  3810. }
  3811. return slots
  3812. }
  3813. function isWhitespace (node) {
  3814. return (node.isComment && !node.asyncFactory) || node.text === ' '
  3815. }
  3816. /* */
  3817. function normalizeScopedSlots (
  3818. slots,
  3819. normalSlots,
  3820. prevSlots
  3821. ) {
  3822. var res;
  3823. var hasNormalSlots = Object.keys(normalSlots).length > 0;
  3824. var isStable = slots ? !!slots.$stable : !hasNormalSlots;
  3825. var key = slots && slots.$key;
  3826. if (!slots) {
  3827. res = {};
  3828. } else if (slots._normalized) {
  3829. // fast path 1: child component re-render only, parent did not change
  3830. return slots._normalized
  3831. } else if (
  3832. isStable &&
  3833. prevSlots &&
  3834. prevSlots !== emptyObject &&
  3835. key === prevSlots.$key &&
  3836. !hasNormalSlots &&
  3837. !prevSlots.$hasNormal
  3838. ) {
  3839. // fast path 2: stable scoped slots w/ no normal slots to proxy,
  3840. // only need to normalize once
  3841. return prevSlots
  3842. } else {
  3843. res = {};
  3844. for (var key$1 in slots) {
  3845. if (slots[key$1] && key$1[0] !== '$') {
  3846. res[key$1] = normalizeScopedSlot(normalSlots, key$1, slots[key$1]);
  3847. }
  3848. }
  3849. }
  3850. // expose normal slots on scopedSlots
  3851. for (var key$2 in normalSlots) {
  3852. if (!(key$2 in res)) {
  3853. res[key$2] = proxyNormalSlot(normalSlots, key$2);
  3854. }
  3855. }
  3856. // avoriaz seems to mock a non-extensible $scopedSlots object
  3857. // and when that is passed down this would cause an error
  3858. if (slots && Object.isExtensible(slots)) {
  3859. (slots)._normalized = res;
  3860. }
  3861. def(res, '$stable', isStable);
  3862. def(res, '$key', key);
  3863. def(res, '$hasNormal', hasNormalSlots);
  3864. return res
  3865. }
  3866. function normalizeScopedSlot(normalSlots, key, fn) {
  3867. var normalized = function () {
  3868. var res = arguments.length ? fn.apply(null, arguments) : fn({});
  3869. res = res && typeof res === 'object' && !Array.isArray(res)
  3870. ? [res] // single vnode
  3871. : normalizeChildren(res);
  3872. return res && (
  3873. res.length === 0 ||
  3874. (res.length === 1 && res[0].isComment) // #9658
  3875. ) ? undefined
  3876. : res
  3877. };
  3878. // this is a slot using the new v-slot syntax without scope. although it is
  3879. // compiled as a scoped slot, render fn users would expect it to be present
  3880. // on this.$slots because the usage is semantically a normal slot.
  3881. if (fn.proxy) {
  3882. Object.defineProperty(normalSlots, key, {
  3883. get: normalized,
  3884. enumerable: true,
  3885. configurable: true
  3886. });
  3887. }
  3888. return normalized
  3889. }
  3890. function proxyNormalSlot(slots, key) {
  3891. return function () { return slots[key]; }
  3892. }
  3893. /* */
  3894. /**
  3895. * Runtime helper for rendering v-for lists.
  3896. */
  3897. function renderList (
  3898. val,
  3899. render
  3900. ) {
  3901. var ret, i, l, keys, key;
  3902. if (Array.isArray(val) || typeof val === 'string') {
  3903. ret = new Array(val.length);
  3904. for (i = 0, l = val.length; i < l; i++) {
  3905. ret[i] = render(val[i], i, i, i); // fixed by xxxxxx
  3906. }
  3907. } else if (typeof val === 'number') {
  3908. ret = new Array(val);
  3909. for (i = 0; i < val; i++) {
  3910. ret[i] = render(i + 1, i, i, i); // fixed by xxxxxx
  3911. }
  3912. } else if (isObject(val)) {
  3913. if (hasSymbol && val[Symbol.iterator]) {
  3914. ret = [];
  3915. var iterator = val[Symbol.iterator]();
  3916. var result = iterator.next();
  3917. while (!result.done) {
  3918. ret.push(render(result.value, ret.length, i, i++)); // fixed by xxxxxx
  3919. result = iterator.next();
  3920. }
  3921. } else {
  3922. keys = Object.keys(val);
  3923. ret = new Array(keys.length);
  3924. for (i = 0, l = keys.length; i < l; i++) {
  3925. key = keys[i];
  3926. ret[i] = render(val[key], key, i, i); // fixed by xxxxxx
  3927. }
  3928. }
  3929. }
  3930. if (!isDef(ret)) {
  3931. ret = [];
  3932. }
  3933. (ret)._isVList = true;
  3934. return ret
  3935. }
  3936. /* */
  3937. /**
  3938. * Runtime helper for rendering <slot>
  3939. */
  3940. function renderSlot (
  3941. name,
  3942. fallback,
  3943. props,
  3944. bindObject
  3945. ) {
  3946. var scopedSlotFn = this.$scopedSlots[name];
  3947. var nodes;
  3948. if (scopedSlotFn) { // scoped slot
  3949. props = props || {};
  3950. if (bindObject) {
  3951. if ( true && !isObject(bindObject)) {
  3952. warn(
  3953. 'slot v-bind without argument expects an Object',
  3954. this
  3955. );
  3956. }
  3957. props = extend(extend({}, bindObject), props);
  3958. }
  3959. // fixed by xxxxxx app-plus scopedSlot
  3960. nodes = scopedSlotFn(props, this, props._i) || fallback;
  3961. } else {
  3962. nodes = this.$slots[name] || fallback;
  3963. }
  3964. var target = props && props.slot;
  3965. if (target) {
  3966. return this.$createElement('template', { slot: target }, nodes)
  3967. } else {
  3968. return nodes
  3969. }
  3970. }
  3971. /* */
  3972. /**
  3973. * Runtime helper for resolving filters
  3974. */
  3975. function resolveFilter (id) {
  3976. return resolveAsset(this.$options, 'filters', id, true) || identity
  3977. }
  3978. /* */
  3979. function isKeyNotMatch (expect, actual) {
  3980. if (Array.isArray(expect)) {
  3981. return expect.indexOf(actual) === -1
  3982. } else {
  3983. return expect !== actual
  3984. }
  3985. }
  3986. /**
  3987. * Runtime helper for checking keyCodes from config.
  3988. * exposed as Vue.prototype._k
  3989. * passing in eventKeyName as last argument separately for backwards compat
  3990. */
  3991. function checkKeyCodes (
  3992. eventKeyCode,
  3993. key,
  3994. builtInKeyCode,
  3995. eventKeyName,
  3996. builtInKeyName
  3997. ) {
  3998. var mappedKeyCode = config.keyCodes[key] || builtInKeyCode;
  3999. if (builtInKeyName && eventKeyName && !config.keyCodes[key]) {
  4000. return isKeyNotMatch(builtInKeyName, eventKeyName)
  4001. } else if (mappedKeyCode) {
  4002. return isKeyNotMatch(mappedKeyCode, eventKeyCode)
  4003. } else if (eventKeyName) {
  4004. return hyphenate(eventKeyName) !== key
  4005. }
  4006. }
  4007. /* */
  4008. /**
  4009. * Runtime helper for merging v-bind="object" into a VNode's data.
  4010. */
  4011. function bindObjectProps (
  4012. data,
  4013. tag,
  4014. value,
  4015. asProp,
  4016. isSync
  4017. ) {
  4018. if (value) {
  4019. if (!isObject(value)) {
  4020. true && warn(
  4021. 'v-bind without argument expects an Object or Array value',
  4022. this
  4023. );
  4024. } else {
  4025. if (Array.isArray(value)) {
  4026. value = toObject(value);
  4027. }
  4028. var hash;
  4029. var loop = function ( key ) {
  4030. if (
  4031. key === 'class' ||
  4032. key === 'style' ||
  4033. isReservedAttribute(key)
  4034. ) {
  4035. hash = data;
  4036. } else {
  4037. var type = data.attrs && data.attrs.type;
  4038. hash = asProp || config.mustUseProp(tag, type, key)
  4039. ? data.domProps || (data.domProps = {})
  4040. : data.attrs || (data.attrs = {});
  4041. }
  4042. var camelizedKey = camelize(key);
  4043. var hyphenatedKey = hyphenate(key);
  4044. if (!(camelizedKey in hash) && !(hyphenatedKey in hash)) {
  4045. hash[key] = value[key];
  4046. if (isSync) {
  4047. var on = data.on || (data.on = {});
  4048. on[("update:" + key)] = function ($event) {
  4049. value[key] = $event;
  4050. };
  4051. }
  4052. }
  4053. };
  4054. for (var key in value) loop( key );
  4055. }
  4056. }
  4057. return data
  4058. }
  4059. /* */
  4060. /**
  4061. * Runtime helper for rendering static trees.
  4062. */
  4063. function renderStatic (
  4064. index,
  4065. isInFor
  4066. ) {
  4067. var cached = this._staticTrees || (this._staticTrees = []);
  4068. var tree = cached[index];
  4069. // if has already-rendered static tree and not inside v-for,
  4070. // we can reuse the same tree.
  4071. if (tree && !isInFor) {
  4072. return tree
  4073. }
  4074. // otherwise, render a fresh tree.
  4075. tree = cached[index] = this.$options.staticRenderFns[index].call(
  4076. this._renderProxy,
  4077. null,
  4078. this // for render fns generated for functional component templates
  4079. );
  4080. markStatic(tree, ("__static__" + index), false);
  4081. return tree
  4082. }
  4083. /**
  4084. * Runtime helper for v-once.
  4085. * Effectively it means marking the node as static with a unique key.
  4086. */
  4087. function markOnce (
  4088. tree,
  4089. index,
  4090. key
  4091. ) {
  4092. markStatic(tree, ("__once__" + index + (key ? ("_" + key) : "")), true);
  4093. return tree
  4094. }
  4095. function markStatic (
  4096. tree,
  4097. key,
  4098. isOnce
  4099. ) {
  4100. if (Array.isArray(tree)) {
  4101. for (var i = 0; i < tree.length; i++) {
  4102. if (tree[i] && typeof tree[i] !== 'string') {
  4103. markStaticNode(tree[i], (key + "_" + i), isOnce);
  4104. }
  4105. }
  4106. } else {
  4107. markStaticNode(tree, key, isOnce);
  4108. }
  4109. }
  4110. function markStaticNode (node, key, isOnce) {
  4111. node.isStatic = true;
  4112. node.key = key;
  4113. node.isOnce = isOnce;
  4114. }
  4115. /* */
  4116. function bindObjectListeners (data, value) {
  4117. if (value) {
  4118. if (!isPlainObject(value)) {
  4119. true && warn(
  4120. 'v-on without argument expects an Object value',
  4121. this
  4122. );
  4123. } else {
  4124. var on = data.on = data.on ? extend({}, data.on) : {};
  4125. for (var key in value) {
  4126. var existing = on[key];
  4127. var ours = value[key];
  4128. on[key] = existing ? [].concat(existing, ours) : ours;
  4129. }
  4130. }
  4131. }
  4132. return data
  4133. }
  4134. /* */
  4135. function resolveScopedSlots (
  4136. fns, // see flow/vnode
  4137. res,
  4138. // the following are added in 2.6
  4139. hasDynamicKeys,
  4140. contentHashKey
  4141. ) {
  4142. res = res || { $stable: !hasDynamicKeys };
  4143. for (var i = 0; i < fns.length; i++) {
  4144. var slot = fns[i];
  4145. if (Array.isArray(slot)) {
  4146. resolveScopedSlots(slot, res, hasDynamicKeys);
  4147. } else if (slot) {
  4148. // marker for reverse proxying v-slot without scope on this.$slots
  4149. if (slot.proxy) {
  4150. slot.fn.proxy = true;
  4151. }
  4152. res[slot.key] = slot.fn;
  4153. }
  4154. }
  4155. if (contentHashKey) {
  4156. (res).$key = contentHashKey;
  4157. }
  4158. return res
  4159. }
  4160. /* */
  4161. function bindDynamicKeys (baseObj, values) {
  4162. for (var i = 0; i < values.length; i += 2) {
  4163. var key = values[i];
  4164. if (typeof key === 'string' && key) {
  4165. baseObj[values[i]] = values[i + 1];
  4166. } else if ( true && key !== '' && key !== null) {
  4167. // null is a special value for explicitly removing a binding
  4168. warn(
  4169. ("Invalid value for dynamic directive argument (expected string or null): " + key),
  4170. this
  4171. );
  4172. }
  4173. }
  4174. return baseObj
  4175. }
  4176. // helper to dynamically append modifier runtime markers to event names.
  4177. // ensure only append when value is already string, otherwise it will be cast
  4178. // to string and cause the type check to miss.
  4179. function prependModifier (value, symbol) {
  4180. return typeof value === 'string' ? symbol + value : value
  4181. }
  4182. /* */
  4183. function installRenderHelpers (target) {
  4184. target._o = markOnce;
  4185. target._n = toNumber;
  4186. target._s = toString;
  4187. target._l = renderList;
  4188. target._t = renderSlot;
  4189. target._q = looseEqual;
  4190. target._i = looseIndexOf;
  4191. target._m = renderStatic;
  4192. target._f = resolveFilter;
  4193. target._k = checkKeyCodes;
  4194. target._b = bindObjectProps;
  4195. target._v = createTextVNode;
  4196. target._e = createEmptyVNode;
  4197. target._u = resolveScopedSlots;
  4198. target._g = bindObjectListeners;
  4199. target._d = bindDynamicKeys;
  4200. target._p = prependModifier;
  4201. }
  4202. /* */
  4203. function FunctionalRenderContext (
  4204. data,
  4205. props,
  4206. children,
  4207. parent,
  4208. Ctor
  4209. ) {
  4210. var this$1 = this;
  4211. var options = Ctor.options;
  4212. // ensure the createElement function in functional components
  4213. // gets a unique context - this is necessary for correct named slot check
  4214. var contextVm;
  4215. if (hasOwn(parent, '_uid')) {
  4216. contextVm = Object.create(parent);
  4217. // $flow-disable-line
  4218. contextVm._original = parent;
  4219. } else {
  4220. // the context vm passed in is a functional context as well.
  4221. // in this case we want to make sure we are able to get a hold to the
  4222. // real context instance.
  4223. contextVm = parent;
  4224. // $flow-disable-line
  4225. parent = parent._original;
  4226. }
  4227. var isCompiled = isTrue(options._compiled);
  4228. var needNormalization = !isCompiled;
  4229. this.data = data;
  4230. this.props = props;
  4231. this.children = children;
  4232. this.parent = parent;
  4233. this.listeners = data.on || emptyObject;
  4234. this.injections = resolveInject(options.inject, parent);
  4235. this.slots = function () {
  4236. if (!this$1.$slots) {
  4237. normalizeScopedSlots(
  4238. data.scopedSlots,
  4239. this$1.$slots = resolveSlots(children, parent)
  4240. );
  4241. }
  4242. return this$1.$slots
  4243. };
  4244. Object.defineProperty(this, 'scopedSlots', ({
  4245. enumerable: true,
  4246. get: function get () {
  4247. return normalizeScopedSlots(data.scopedSlots, this.slots())
  4248. }
  4249. }));
  4250. // support for compiled functional template
  4251. if (isCompiled) {
  4252. // exposing $options for renderStatic()
  4253. this.$options = options;
  4254. // pre-resolve slots for renderSlot()
  4255. this.$slots = this.slots();
  4256. this.$scopedSlots = normalizeScopedSlots(data.scopedSlots, this.$slots);
  4257. }
  4258. if (options._scopeId) {
  4259. this._c = function (a, b, c, d) {
  4260. var vnode = createElement(contextVm, a, b, c, d, needNormalization);
  4261. if (vnode && !Array.isArray(vnode)) {
  4262. vnode.fnScopeId = options._scopeId;
  4263. vnode.fnContext = parent;
  4264. }
  4265. return vnode
  4266. };
  4267. } else {
  4268. this._c = function (a, b, c, d) { return createElement(contextVm, a, b, c, d, needNormalization); };
  4269. }
  4270. }
  4271. installRenderHelpers(FunctionalRenderContext.prototype);
  4272. function createFunctionalComponent (
  4273. Ctor,
  4274. propsData,
  4275. data,
  4276. contextVm,
  4277. children
  4278. ) {
  4279. var options = Ctor.options;
  4280. var props = {};
  4281. var propOptions = options.props;
  4282. if (isDef(propOptions)) {
  4283. for (var key in propOptions) {
  4284. props[key] = validateProp(key, propOptions, propsData || emptyObject);
  4285. }
  4286. } else {
  4287. if (isDef(data.attrs)) { mergeProps(props, data.attrs); }
  4288. if (isDef(data.props)) { mergeProps(props, data.props); }
  4289. }
  4290. var renderContext = new FunctionalRenderContext(
  4291. data,
  4292. props,
  4293. children,
  4294. contextVm,
  4295. Ctor
  4296. );
  4297. var vnode = options.render.call(null, renderContext._c, renderContext);
  4298. if (vnode instanceof VNode) {
  4299. return cloneAndMarkFunctionalResult(vnode, data, renderContext.parent, options, renderContext)
  4300. } else if (Array.isArray(vnode)) {
  4301. var vnodes = normalizeChildren(vnode) || [];
  4302. var res = new Array(vnodes.length);
  4303. for (var i = 0; i < vnodes.length; i++) {
  4304. res[i] = cloneAndMarkFunctionalResult(vnodes[i], data, renderContext.parent, options, renderContext);
  4305. }
  4306. return res
  4307. }
  4308. }
  4309. function cloneAndMarkFunctionalResult (vnode, data, contextVm, options, renderContext) {
  4310. // #7817 clone node before setting fnContext, otherwise if the node is reused
  4311. // (e.g. it was from a cached normal slot) the fnContext causes named slots
  4312. // that should not be matched to match.
  4313. var clone = cloneVNode(vnode);
  4314. clone.fnContext = contextVm;
  4315. clone.fnOptions = options;
  4316. if (true) {
  4317. (clone.devtoolsMeta = clone.devtoolsMeta || {}).renderContext = renderContext;
  4318. }
  4319. if (data.slot) {
  4320. (clone.data || (clone.data = {})).slot = data.slot;
  4321. }
  4322. return clone
  4323. }
  4324. function mergeProps (to, from) {
  4325. for (var key in from) {
  4326. to[camelize(key)] = from[key];
  4327. }
  4328. }
  4329. /* */
  4330. /* */
  4331. /* */
  4332. /* */
  4333. // inline hooks to be invoked on component VNodes during patch
  4334. var componentVNodeHooks = {
  4335. init: function init (vnode, hydrating) {
  4336. if (
  4337. vnode.componentInstance &&
  4338. !vnode.componentInstance._isDestroyed &&
  4339. vnode.data.keepAlive
  4340. ) {
  4341. // kept-alive components, treat as a patch
  4342. var mountedNode = vnode; // work around flow
  4343. componentVNodeHooks.prepatch(mountedNode, mountedNode);
  4344. } else {
  4345. var child = vnode.componentInstance = createComponentInstanceForVnode(
  4346. vnode,
  4347. activeInstance
  4348. );
  4349. child.$mount(hydrating ? vnode.elm : undefined, hydrating);
  4350. }
  4351. },
  4352. prepatch: function prepatch (oldVnode, vnode) {
  4353. var options = vnode.componentOptions;
  4354. var child = vnode.componentInstance = oldVnode.componentInstance;
  4355. updateChildComponent(
  4356. child,
  4357. options.propsData, // updated props
  4358. options.listeners, // updated listeners
  4359. vnode, // new parent vnode
  4360. options.children // new children
  4361. );
  4362. },
  4363. insert: function insert (vnode) {
  4364. var context = vnode.context;
  4365. var componentInstance = vnode.componentInstance;
  4366. if (!componentInstance._isMounted) {
  4367. callHook(componentInstance, 'onServiceCreated');
  4368. callHook(componentInstance, 'onServiceAttached');
  4369. componentInstance._isMounted = true;
  4370. callHook(componentInstance, 'mounted');
  4371. }
  4372. if (vnode.data.keepAlive) {
  4373. if (context._isMounted) {
  4374. // vue-router#1212
  4375. // During updates, a kept-alive component's child components may
  4376. // change, so directly walking the tree here may call activated hooks
  4377. // on incorrect children. Instead we push them into a queue which will
  4378. // be processed after the whole patch process ended.
  4379. queueActivatedComponent(componentInstance);
  4380. } else {
  4381. activateChildComponent(componentInstance, true /* direct */);
  4382. }
  4383. }
  4384. },
  4385. destroy: function destroy (vnode) {
  4386. var componentInstance = vnode.componentInstance;
  4387. if (!componentInstance._isDestroyed) {
  4388. if (!vnode.data.keepAlive) {
  4389. componentInstance.$destroy();
  4390. } else {
  4391. deactivateChildComponent(componentInstance, true /* direct */);
  4392. }
  4393. }
  4394. }
  4395. };
  4396. var hooksToMerge = Object.keys(componentVNodeHooks);
  4397. function createComponent (
  4398. Ctor,
  4399. data,
  4400. context,
  4401. children,
  4402. tag
  4403. ) {
  4404. if (isUndef(Ctor)) {
  4405. return
  4406. }
  4407. var baseCtor = context.$options._base;
  4408. // plain options object: turn it into a constructor
  4409. if (isObject(Ctor)) {
  4410. Ctor = baseCtor.extend(Ctor);
  4411. }
  4412. // if at this stage it's not a constructor or an async component factory,
  4413. // reject.
  4414. if (typeof Ctor !== 'function') {
  4415. if (true) {
  4416. warn(("Invalid Component definition: " + (String(Ctor))), context);
  4417. }
  4418. return
  4419. }
  4420. // async component
  4421. var asyncFactory;
  4422. if (isUndef(Ctor.cid)) {
  4423. asyncFactory = Ctor;
  4424. Ctor = resolveAsyncComponent(asyncFactory, baseCtor);
  4425. if (Ctor === undefined) {
  4426. // return a placeholder node for async component, which is rendered
  4427. // as a comment node but preserves all the raw information for the node.
  4428. // the information will be used for async server-rendering and hydration.
  4429. return createAsyncPlaceholder(
  4430. asyncFactory,
  4431. data,
  4432. context,
  4433. children,
  4434. tag
  4435. )
  4436. }
  4437. }
  4438. data = data || {};
  4439. // resolve constructor options in case global mixins are applied after
  4440. // component constructor creation
  4441. resolveConstructorOptions(Ctor);
  4442. // transform component v-model data into props & events
  4443. if (isDef(data.model)) {
  4444. transformModel(Ctor.options, data);
  4445. }
  4446. // extract props
  4447. var propsData = extractPropsFromVNodeData(data, Ctor, tag, context); // fixed by xxxxxx
  4448. // functional component
  4449. if (isTrue(Ctor.options.functional)) {
  4450. return createFunctionalComponent(Ctor, propsData, data, context, children)
  4451. }
  4452. // extract listeners, since these needs to be treated as
  4453. // child component listeners instead of DOM listeners
  4454. var listeners = data.on;
  4455. // replace with listeners with .native modifier
  4456. // so it gets processed during parent component patch.
  4457. data.on = data.nativeOn;
  4458. if (isTrue(Ctor.options.abstract)) {
  4459. // abstract components do not keep anything
  4460. // other than props & listeners & slot
  4461. // work around flow
  4462. var slot = data.slot;
  4463. data = {};
  4464. if (slot) {
  4465. data.slot = slot;
  4466. }
  4467. }
  4468. // install component management hooks onto the placeholder node
  4469. installComponentHooks(data);
  4470. // return a placeholder vnode
  4471. var name = Ctor.options.name || tag;
  4472. var vnode = new VNode(
  4473. ("vue-component-" + (Ctor.cid) + (name ? ("-" + name) : '')),
  4474. data, undefined, undefined, undefined, context,
  4475. { Ctor: Ctor, propsData: propsData, listeners: listeners, tag: tag, children: children },
  4476. asyncFactory
  4477. );
  4478. return vnode
  4479. }
  4480. function createComponentInstanceForVnode (
  4481. vnode, // we know it's MountedComponentVNode but flow doesn't
  4482. parent // activeInstance in lifecycle state
  4483. ) {
  4484. var options = {
  4485. _isComponent: true,
  4486. _parentVnode: vnode,
  4487. parent: parent
  4488. };
  4489. // check inline-template render functions
  4490. var inlineTemplate = vnode.data.inlineTemplate;
  4491. if (isDef(inlineTemplate)) {
  4492. options.render = inlineTemplate.render;
  4493. options.staticRenderFns = inlineTemplate.staticRenderFns;
  4494. }
  4495. return new vnode.componentOptions.Ctor(options)
  4496. }
  4497. function installComponentHooks (data) {
  4498. var hooks = data.hook || (data.hook = {});
  4499. for (var i = 0; i < hooksToMerge.length; i++) {
  4500. var key = hooksToMerge[i];
  4501. var existing = hooks[key];
  4502. var toMerge = componentVNodeHooks[key];
  4503. if (existing !== toMerge && !(existing && existing._merged)) {
  4504. hooks[key] = existing ? mergeHook$1(toMerge, existing) : toMerge;
  4505. }
  4506. }
  4507. }
  4508. function mergeHook$1 (f1, f2) {
  4509. var merged = function (a, b) {
  4510. // flow complains about extra args which is why we use any
  4511. f1(a, b);
  4512. f2(a, b);
  4513. };
  4514. merged._merged = true;
  4515. return merged
  4516. }
  4517. // transform component v-model info (value and callback) into
  4518. // prop and event handler respectively.
  4519. function transformModel (options, data) {
  4520. var prop = (options.model && options.model.prop) || 'value';
  4521. var event = (options.model && options.model.event) || 'input'
  4522. ;(data.attrs || (data.attrs = {}))[prop] = data.model.value;
  4523. var on = data.on || (data.on = {});
  4524. var existing = on[event];
  4525. var callback = data.model.callback;
  4526. if (isDef(existing)) {
  4527. if (
  4528. Array.isArray(existing)
  4529. ? existing.indexOf(callback) === -1
  4530. : existing !== callback
  4531. ) {
  4532. on[event] = [callback].concat(existing);
  4533. }
  4534. } else {
  4535. on[event] = callback;
  4536. }
  4537. }
  4538. /* */
  4539. var SIMPLE_NORMALIZE = 1;
  4540. var ALWAYS_NORMALIZE = 2;
  4541. // wrapper function for providing a more flexible interface
  4542. // without getting yelled at by flow
  4543. function createElement (
  4544. context,
  4545. tag,
  4546. data,
  4547. children,
  4548. normalizationType,
  4549. alwaysNormalize
  4550. ) {
  4551. if (Array.isArray(data) || isPrimitive(data)) {
  4552. normalizationType = children;
  4553. children = data;
  4554. data = undefined;
  4555. }
  4556. if (isTrue(alwaysNormalize)) {
  4557. normalizationType = ALWAYS_NORMALIZE;
  4558. }
  4559. return _createElement(context, tag, data, children, normalizationType)
  4560. }
  4561. function _createElement (
  4562. context,
  4563. tag,
  4564. data,
  4565. children,
  4566. normalizationType
  4567. ) {
  4568. if (isDef(data) && isDef((data).__ob__)) {
  4569. true && warn(
  4570. "Avoid using observed data object as vnode data: " + (JSON.stringify(data)) + "\n" +
  4571. 'Always create fresh vnode data objects in each render!',
  4572. context
  4573. );
  4574. return createEmptyVNode()
  4575. }
  4576. // object syntax in v-bind
  4577. if (isDef(data) && isDef(data.is)) {
  4578. tag = data.is;
  4579. }
  4580. if (!tag) {
  4581. // in case of component :is set to falsy value
  4582. return createEmptyVNode()
  4583. }
  4584. // warn against non-primitive key
  4585. if ( true &&
  4586. isDef(data) && isDef(data.key) && !isPrimitive(data.key)
  4587. ) {
  4588. {
  4589. warn(
  4590. 'Avoid using non-primitive value as key, ' +
  4591. 'use string/number value instead.',
  4592. context
  4593. );
  4594. }
  4595. }
  4596. // support single function children as default scoped slot
  4597. if (Array.isArray(children) &&
  4598. typeof children[0] === 'function'
  4599. ) {
  4600. data = data || {};
  4601. data.scopedSlots = { default: children[0] };
  4602. children.length = 0;
  4603. }
  4604. if (normalizationType === ALWAYS_NORMALIZE) {
  4605. children = normalizeChildren(children);
  4606. } else if (normalizationType === SIMPLE_NORMALIZE) {
  4607. children = simpleNormalizeChildren(children);
  4608. }
  4609. var vnode, ns;
  4610. if (typeof tag === 'string') {
  4611. var Ctor;
  4612. ns = (context.$vnode && context.$vnode.ns) || config.getTagNamespace(tag);
  4613. if (config.isReservedTag(tag)) {
  4614. // platform built-in elements
  4615. if ( true && isDef(data) && isDef(data.nativeOn)) {
  4616. warn(
  4617. ("The .native modifier for v-on is only valid on components but it was used on <" + tag + ">."),
  4618. context
  4619. );
  4620. }
  4621. vnode = new VNode(
  4622. config.parsePlatformTagName(tag), data, children,
  4623. undefined, undefined, context
  4624. );
  4625. } else if ((!data || !data.pre) && isDef(Ctor = resolveAsset(context.$options, 'components', tag))) {
  4626. // component
  4627. vnode = createComponent(Ctor, data, context, children, tag);
  4628. } else {
  4629. // unknown or unlisted namespaced elements
  4630. // check at runtime because it may get assigned a namespace when its
  4631. // parent normalizes children
  4632. vnode = new VNode(
  4633. tag, data, children,
  4634. undefined, undefined, context
  4635. );
  4636. }
  4637. } else {
  4638. // direct component options / constructor
  4639. vnode = createComponent(tag, data, context, children);
  4640. }
  4641. if (Array.isArray(vnode)) {
  4642. return vnode
  4643. } else if (isDef(vnode)) {
  4644. if (isDef(ns)) { applyNS(vnode, ns); }
  4645. if (isDef(data)) { registerDeepBindings(data); }
  4646. return vnode
  4647. } else {
  4648. return createEmptyVNode()
  4649. }
  4650. }
  4651. function applyNS (vnode, ns, force) {
  4652. vnode.ns = ns;
  4653. if (vnode.tag === 'foreignObject') {
  4654. // use default namespace inside foreignObject
  4655. ns = undefined;
  4656. force = true;
  4657. }
  4658. if (isDef(vnode.children)) {
  4659. for (var i = 0, l = vnode.children.length; i < l; i++) {
  4660. var child = vnode.children[i];
  4661. if (isDef(child.tag) && (
  4662. isUndef(child.ns) || (isTrue(force) && child.tag !== 'svg'))) {
  4663. applyNS(child, ns, force);
  4664. }
  4665. }
  4666. }
  4667. }
  4668. // ref #5318
  4669. // necessary to ensure parent re-render when deep bindings like :style and
  4670. // :class are used on slot nodes
  4671. function registerDeepBindings (data) {
  4672. if (isObject(data.style)) {
  4673. traverse(data.style);
  4674. }
  4675. if (isObject(data.class)) {
  4676. traverse(data.class);
  4677. }
  4678. }
  4679. /* */
  4680. function initRender (vm) {
  4681. vm._vnode = null; // the root of the child tree
  4682. vm._staticTrees = null; // v-once cached trees
  4683. var options = vm.$options;
  4684. var parentVnode = vm.$vnode = options._parentVnode; // the placeholder node in parent tree
  4685. var renderContext = parentVnode && parentVnode.context;
  4686. vm.$slots = resolveSlots(options._renderChildren, renderContext);
  4687. vm.$scopedSlots = emptyObject;
  4688. // bind the createElement fn to this instance
  4689. // so that we get proper render context inside it.
  4690. // args order: tag, data, children, normalizationType, alwaysNormalize
  4691. // internal version is used by render functions compiled from templates
  4692. vm._c = function (a, b, c, d) { return createElement(vm, a, b, c, d, false); };
  4693. // normalization is always applied for the public version, used in
  4694. // user-written render functions.
  4695. vm.$createElement = function (a, b, c, d) { return createElement(vm, a, b, c, d, true); };
  4696. // $attrs & $listeners are exposed for easier HOC creation.
  4697. // they need to be reactive so that HOCs using them are always updated
  4698. var parentData = parentVnode && parentVnode.data;
  4699. /* istanbul ignore else */
  4700. if (true) {
  4701. defineReactive$$1(vm, '$attrs', parentData && parentData.attrs || emptyObject, function () {
  4702. !isUpdatingChildComponent && warn("$attrs is readonly.", vm);
  4703. }, true);
  4704. defineReactive$$1(vm, '$listeners', options._parentListeners || emptyObject, function () {
  4705. !isUpdatingChildComponent && warn("$listeners is readonly.", vm);
  4706. }, true);
  4707. } else {}
  4708. }
  4709. var currentRenderingInstance = null;
  4710. function renderMixin (Vue) {
  4711. // install runtime convenience helpers
  4712. installRenderHelpers(Vue.prototype);
  4713. Vue.prototype.$nextTick = function (fn) {
  4714. return nextTick(fn, this)
  4715. };
  4716. Vue.prototype._render = function () {
  4717. var vm = this;
  4718. var ref = vm.$options;
  4719. var render = ref.render;
  4720. var _parentVnode = ref._parentVnode;
  4721. if (_parentVnode) {
  4722. vm.$scopedSlots = normalizeScopedSlots(
  4723. _parentVnode.data.scopedSlots,
  4724. vm.$slots,
  4725. vm.$scopedSlots
  4726. );
  4727. }
  4728. // set parent vnode. this allows render functions to have access
  4729. // to the data on the placeholder node.
  4730. vm.$vnode = _parentVnode;
  4731. // render self
  4732. var vnode;
  4733. try {
  4734. // There's no need to maintain a stack because all render fns are called
  4735. // separately from one another. Nested component's render fns are called
  4736. // when parent component is patched.
  4737. currentRenderingInstance = vm;
  4738. vnode = render.call(vm._renderProxy, vm.$createElement);
  4739. } catch (e) {
  4740. handleError(e, vm, "render");
  4741. // return error render result,
  4742. // or previous vnode to prevent render error causing blank component
  4743. /* istanbul ignore else */
  4744. if ( true && vm.$options.renderError) {
  4745. try {
  4746. vnode = vm.$options.renderError.call(vm._renderProxy, vm.$createElement, e);
  4747. } catch (e) {
  4748. handleError(e, vm, "renderError");
  4749. vnode = vm._vnode;
  4750. }
  4751. } else {
  4752. vnode = vm._vnode;
  4753. }
  4754. } finally {
  4755. currentRenderingInstance = null;
  4756. }
  4757. // if the returned array contains only a single node, allow it
  4758. if (Array.isArray(vnode) && vnode.length === 1) {
  4759. vnode = vnode[0];
  4760. }
  4761. // return empty vnode in case the render function errored out
  4762. if (!(vnode instanceof VNode)) {
  4763. if ( true && Array.isArray(vnode)) {
  4764. warn(
  4765. 'Multiple root nodes returned from render function. Render function ' +
  4766. 'should return a single root node.',
  4767. vm
  4768. );
  4769. }
  4770. vnode = createEmptyVNode();
  4771. }
  4772. // set parent
  4773. vnode.parent = _parentVnode;
  4774. return vnode
  4775. };
  4776. }
  4777. /* */
  4778. function ensureCtor (comp, base) {
  4779. if (
  4780. comp.__esModule ||
  4781. (hasSymbol && comp[Symbol.toStringTag] === 'Module')
  4782. ) {
  4783. comp = comp.default;
  4784. }
  4785. return isObject(comp)
  4786. ? base.extend(comp)
  4787. : comp
  4788. }
  4789. function createAsyncPlaceholder (
  4790. factory,
  4791. data,
  4792. context,
  4793. children,
  4794. tag
  4795. ) {
  4796. var node = createEmptyVNode();
  4797. node.asyncFactory = factory;
  4798. node.asyncMeta = { data: data, context: context, children: children, tag: tag };
  4799. return node
  4800. }
  4801. function resolveAsyncComponent (
  4802. factory,
  4803. baseCtor
  4804. ) {
  4805. if (isTrue(factory.error) && isDef(factory.errorComp)) {
  4806. return factory.errorComp
  4807. }
  4808. if (isDef(factory.resolved)) {
  4809. return factory.resolved
  4810. }
  4811. var owner = currentRenderingInstance;
  4812. if (owner && isDef(factory.owners) && factory.owners.indexOf(owner) === -1) {
  4813. // already pending
  4814. factory.owners.push(owner);
  4815. }
  4816. if (isTrue(factory.loading) && isDef(factory.loadingComp)) {
  4817. return factory.loadingComp
  4818. }
  4819. if (owner && !isDef(factory.owners)) {
  4820. var owners = factory.owners = [owner];
  4821. var sync = true;
  4822. var timerLoading = null;
  4823. var timerTimeout = null
  4824. ;(owner).$on('hook:destroyed', function () { return remove(owners, owner); });
  4825. var forceRender = function (renderCompleted) {
  4826. for (var i = 0, l = owners.length; i < l; i++) {
  4827. (owners[i]).$forceUpdate();
  4828. }
  4829. if (renderCompleted) {
  4830. owners.length = 0;
  4831. if (timerLoading !== null) {
  4832. clearTimeout(timerLoading);
  4833. timerLoading = null;
  4834. }
  4835. if (timerTimeout !== null) {
  4836. clearTimeout(timerTimeout);
  4837. timerTimeout = null;
  4838. }
  4839. }
  4840. };
  4841. var resolve = once(function (res) {
  4842. // cache resolved
  4843. factory.resolved = ensureCtor(res, baseCtor);
  4844. // invoke callbacks only if this is not a synchronous resolve
  4845. // (async resolves are shimmed as synchronous during SSR)
  4846. if (!sync) {
  4847. forceRender(true);
  4848. } else {
  4849. owners.length = 0;
  4850. }
  4851. });
  4852. var reject = once(function (reason) {
  4853. true && warn(
  4854. "Failed to resolve async component: " + (String(factory)) +
  4855. (reason ? ("\nReason: " + reason) : '')
  4856. );
  4857. if (isDef(factory.errorComp)) {
  4858. factory.error = true;
  4859. forceRender(true);
  4860. }
  4861. });
  4862. var res = factory(resolve, reject);
  4863. if (isObject(res)) {
  4864. if (isPromise(res)) {
  4865. // () => Promise
  4866. if (isUndef(factory.resolved)) {
  4867. res.then(resolve, reject);
  4868. }
  4869. } else if (isPromise(res.component)) {
  4870. res.component.then(resolve, reject);
  4871. if (isDef(res.error)) {
  4872. factory.errorComp = ensureCtor(res.error, baseCtor);
  4873. }
  4874. if (isDef(res.loading)) {
  4875. factory.loadingComp = ensureCtor(res.loading, baseCtor);
  4876. if (res.delay === 0) {
  4877. factory.loading = true;
  4878. } else {
  4879. timerLoading = setTimeout(function () {
  4880. timerLoading = null;
  4881. if (isUndef(factory.resolved) && isUndef(factory.error)) {
  4882. factory.loading = true;
  4883. forceRender(false);
  4884. }
  4885. }, res.delay || 200);
  4886. }
  4887. }
  4888. if (isDef(res.timeout)) {
  4889. timerTimeout = setTimeout(function () {
  4890. timerTimeout = null;
  4891. if (isUndef(factory.resolved)) {
  4892. reject(
  4893. true
  4894. ? ("timeout (" + (res.timeout) + "ms)")
  4895. : undefined
  4896. );
  4897. }
  4898. }, res.timeout);
  4899. }
  4900. }
  4901. }
  4902. sync = false;
  4903. // return in case resolved synchronously
  4904. return factory.loading
  4905. ? factory.loadingComp
  4906. : factory.resolved
  4907. }
  4908. }
  4909. /* */
  4910. function isAsyncPlaceholder (node) {
  4911. return node.isComment && node.asyncFactory
  4912. }
  4913. /* */
  4914. function getFirstComponentChild (children) {
  4915. if (Array.isArray(children)) {
  4916. for (var i = 0; i < children.length; i++) {
  4917. var c = children[i];
  4918. if (isDef(c) && (isDef(c.componentOptions) || isAsyncPlaceholder(c))) {
  4919. return c
  4920. }
  4921. }
  4922. }
  4923. }
  4924. /* */
  4925. /* */
  4926. function initEvents (vm) {
  4927. vm._events = Object.create(null);
  4928. vm._hasHookEvent = false;
  4929. // init parent attached events
  4930. var listeners = vm.$options._parentListeners;
  4931. if (listeners) {
  4932. updateComponentListeners(vm, listeners);
  4933. }
  4934. }
  4935. var target;
  4936. function add (event, fn) {
  4937. target.$on(event, fn);
  4938. }
  4939. function remove$1 (event, fn) {
  4940. target.$off(event, fn);
  4941. }
  4942. function createOnceHandler (event, fn) {
  4943. var _target = target;
  4944. return function onceHandler () {
  4945. var res = fn.apply(null, arguments);
  4946. if (res !== null) {
  4947. _target.$off(event, onceHandler);
  4948. }
  4949. }
  4950. }
  4951. function updateComponentListeners (
  4952. vm,
  4953. listeners,
  4954. oldListeners
  4955. ) {
  4956. target = vm;
  4957. updateListeners(listeners, oldListeners || {}, add, remove$1, createOnceHandler, vm);
  4958. target = undefined;
  4959. }
  4960. function eventsMixin (Vue) {
  4961. var hookRE = /^hook:/;
  4962. Vue.prototype.$on = function (event, fn) {
  4963. var vm = this;
  4964. if (Array.isArray(event)) {
  4965. for (var i = 0, l = event.length; i < l; i++) {
  4966. vm.$on(event[i], fn);
  4967. }
  4968. } else {
  4969. (vm._events[event] || (vm._events[event] = [])).push(fn);
  4970. // optimize hook:event cost by using a boolean flag marked at registration
  4971. // instead of a hash lookup
  4972. if (hookRE.test(event)) {
  4973. vm._hasHookEvent = true;
  4974. }
  4975. }
  4976. return vm
  4977. };
  4978. Vue.prototype.$once = function (event, fn) {
  4979. var vm = this;
  4980. function on () {
  4981. vm.$off(event, on);
  4982. fn.apply(vm, arguments);
  4983. }
  4984. on.fn = fn;
  4985. vm.$on(event, on);
  4986. return vm
  4987. };
  4988. Vue.prototype.$off = function (event, fn) {
  4989. var vm = this;
  4990. // all
  4991. if (!arguments.length) {
  4992. vm._events = Object.create(null);
  4993. return vm
  4994. }
  4995. // array of events
  4996. if (Array.isArray(event)) {
  4997. for (var i$1 = 0, l = event.length; i$1 < l; i$1++) {
  4998. vm.$off(event[i$1], fn);
  4999. }
  5000. return vm
  5001. }
  5002. // specific event
  5003. var cbs = vm._events[event];
  5004. if (!cbs) {
  5005. return vm
  5006. }
  5007. if (!fn) {
  5008. vm._events[event] = null;
  5009. return vm
  5010. }
  5011. // specific handler
  5012. var cb;
  5013. var i = cbs.length;
  5014. while (i--) {
  5015. cb = cbs[i];
  5016. if (cb === fn || cb.fn === fn) {
  5017. cbs.splice(i, 1);
  5018. break
  5019. }
  5020. }
  5021. return vm
  5022. };
  5023. Vue.prototype.$emit = function (event) {
  5024. var vm = this;
  5025. if (true) {
  5026. var lowerCaseEvent = event.toLowerCase();
  5027. if (lowerCaseEvent !== event && vm._events[lowerCaseEvent]) {
  5028. tip(
  5029. "Event \"" + lowerCaseEvent + "\" is emitted in component " +
  5030. (formatComponentName(vm)) + " but the handler is registered for \"" + event + "\". " +
  5031. "Note that HTML attributes are case-insensitive and you cannot use " +
  5032. "v-on to listen to camelCase events when using in-DOM templates. " +
  5033. "You should probably use \"" + (hyphenate(event)) + "\" instead of \"" + event + "\"."
  5034. );
  5035. }
  5036. }
  5037. var cbs = vm._events[event];
  5038. if (cbs) {
  5039. cbs = cbs.length > 1 ? toArray(cbs) : cbs;
  5040. var args = toArray(arguments, 1);
  5041. var info = "event handler for \"" + event + "\"";
  5042. for (var i = 0, l = cbs.length; i < l; i++) {
  5043. invokeWithErrorHandling(cbs[i], vm, args, vm, info);
  5044. }
  5045. }
  5046. return vm
  5047. };
  5048. }
  5049. /* */
  5050. var activeInstance = null;
  5051. var isUpdatingChildComponent = false;
  5052. function setActiveInstance(vm) {
  5053. var prevActiveInstance = activeInstance;
  5054. activeInstance = vm;
  5055. return function () {
  5056. activeInstance = prevActiveInstance;
  5057. }
  5058. }
  5059. function initLifecycle (vm) {
  5060. var options = vm.$options;
  5061. // locate first non-abstract parent
  5062. var parent = options.parent;
  5063. if (parent && !options.abstract) {
  5064. while (parent.$options.abstract && parent.$parent) {
  5065. parent = parent.$parent;
  5066. }
  5067. parent.$children.push(vm);
  5068. }
  5069. vm.$parent = parent;
  5070. vm.$root = parent ? parent.$root : vm;
  5071. vm.$children = [];
  5072. vm.$refs = {};
  5073. vm._watcher = null;
  5074. vm._inactive = null;
  5075. vm._directInactive = false;
  5076. vm._isMounted = false;
  5077. vm._isDestroyed = false;
  5078. vm._isBeingDestroyed = false;
  5079. }
  5080. function lifecycleMixin (Vue) {
  5081. Vue.prototype._update = function (vnode, hydrating) {
  5082. var vm = this;
  5083. var prevEl = vm.$el;
  5084. var prevVnode = vm._vnode;
  5085. var restoreActiveInstance = setActiveInstance(vm);
  5086. vm._vnode = vnode;
  5087. // Vue.prototype.__patch__ is injected in entry points
  5088. // based on the rendering backend used.
  5089. if (!prevVnode) {
  5090. // initial render
  5091. vm.$el = vm.__patch__(vm.$el, vnode, hydrating, false /* removeOnly */);
  5092. } else {
  5093. // updates
  5094. vm.$el = vm.__patch__(prevVnode, vnode);
  5095. }
  5096. restoreActiveInstance();
  5097. // update __vue__ reference
  5098. if (prevEl) {
  5099. prevEl.__vue__ = null;
  5100. }
  5101. if (vm.$el) {
  5102. vm.$el.__vue__ = vm;
  5103. }
  5104. // if parent is an HOC, update its $el as well
  5105. if (vm.$vnode && vm.$parent && vm.$vnode === vm.$parent._vnode) {
  5106. vm.$parent.$el = vm.$el;
  5107. }
  5108. // updated hook is called by the scheduler to ensure that children are
  5109. // updated in a parent's updated hook.
  5110. };
  5111. Vue.prototype.$forceUpdate = function () {
  5112. var vm = this;
  5113. if (vm._watcher) {
  5114. vm._watcher.update();
  5115. }
  5116. };
  5117. Vue.prototype.$destroy = function () {
  5118. var vm = this;
  5119. if (vm._isBeingDestroyed) {
  5120. return
  5121. }
  5122. callHook(vm, 'beforeDestroy');
  5123. vm._isBeingDestroyed = true;
  5124. // remove self from parent
  5125. var parent = vm.$parent;
  5126. if (parent && !parent._isBeingDestroyed && !vm.$options.abstract) {
  5127. remove(parent.$children, vm);
  5128. }
  5129. // teardown watchers
  5130. if (vm._watcher) {
  5131. vm._watcher.teardown();
  5132. }
  5133. var i = vm._watchers.length;
  5134. while (i--) {
  5135. vm._watchers[i].teardown();
  5136. }
  5137. // remove reference from data ob
  5138. // frozen object may not have observer.
  5139. if (vm._data.__ob__) {
  5140. vm._data.__ob__.vmCount--;
  5141. }
  5142. // call the last hook...
  5143. vm._isDestroyed = true;
  5144. // invoke destroy hooks on current rendered tree
  5145. vm.__patch__(vm._vnode, null);
  5146. // fire destroyed hook
  5147. callHook(vm, 'destroyed');
  5148. // turn off all instance listeners.
  5149. vm.$off();
  5150. // remove __vue__ reference
  5151. if (vm.$el) {
  5152. vm.$el.__vue__ = null;
  5153. }
  5154. // release circular reference (#6759)
  5155. if (vm.$vnode) {
  5156. vm.$vnode.parent = null;
  5157. }
  5158. };
  5159. }
  5160. function updateChildComponent (
  5161. vm,
  5162. propsData,
  5163. listeners,
  5164. parentVnode,
  5165. renderChildren
  5166. ) {
  5167. if (true) {
  5168. isUpdatingChildComponent = true;
  5169. }
  5170. // determine whether component has slot children
  5171. // we need to do this before overwriting $options._renderChildren.
  5172. // check if there are dynamic scopedSlots (hand-written or compiled but with
  5173. // dynamic slot names). Static scoped slots compiled from template has the
  5174. // "$stable" marker.
  5175. var newScopedSlots = parentVnode.data.scopedSlots;
  5176. var oldScopedSlots = vm.$scopedSlots;
  5177. var hasDynamicScopedSlot = !!(
  5178. (newScopedSlots && !newScopedSlots.$stable) ||
  5179. (oldScopedSlots !== emptyObject && !oldScopedSlots.$stable) ||
  5180. (newScopedSlots && vm.$scopedSlots.$key !== newScopedSlots.$key)
  5181. );
  5182. // Any static slot children from the parent may have changed during parent's
  5183. // update. Dynamic scoped slots may also have changed. In such cases, a forced
  5184. // update is necessary to ensure correctness.
  5185. var needsForceUpdate = !!(
  5186. renderChildren || // has new static slots
  5187. vm.$options._renderChildren || // has old static slots
  5188. hasDynamicScopedSlot
  5189. );
  5190. vm.$options._parentVnode = parentVnode;
  5191. vm.$vnode = parentVnode; // update vm's placeholder node without re-render
  5192. if (vm._vnode) { // update child tree's parent
  5193. vm._vnode.parent = parentVnode;
  5194. }
  5195. vm.$options._renderChildren = renderChildren;
  5196. // update $attrs and $listeners hash
  5197. // these are also reactive so they may trigger child update if the child
  5198. // used them during render
  5199. vm.$attrs = parentVnode.data.attrs || emptyObject;
  5200. vm.$listeners = listeners || emptyObject;
  5201. // update props
  5202. if (propsData && vm.$options.props) {
  5203. toggleObserving(false);
  5204. var props = vm._props;
  5205. var propKeys = vm.$options._propKeys || [];
  5206. for (var i = 0; i < propKeys.length; i++) {
  5207. var key = propKeys[i];
  5208. var propOptions = vm.$options.props; // wtf flow?
  5209. props[key] = validateProp(key, propOptions, propsData, vm);
  5210. }
  5211. toggleObserving(true);
  5212. // keep a copy of raw propsData
  5213. vm.$options.propsData = propsData;
  5214. }
  5215. // fixed by xxxxxx update properties(mp runtime)
  5216. vm._$updateProperties && vm._$updateProperties(vm);
  5217. // update listeners
  5218. listeners = listeners || emptyObject;
  5219. var oldListeners = vm.$options._parentListeners;
  5220. vm.$options._parentListeners = listeners;
  5221. updateComponentListeners(vm, listeners, oldListeners);
  5222. // resolve slots + force update if has children
  5223. if (needsForceUpdate) {
  5224. vm.$slots = resolveSlots(renderChildren, parentVnode.context);
  5225. vm.$forceUpdate();
  5226. }
  5227. if (true) {
  5228. isUpdatingChildComponent = false;
  5229. }
  5230. }
  5231. function isInInactiveTree (vm) {
  5232. while (vm && (vm = vm.$parent)) {
  5233. if (vm._inactive) { return true }
  5234. }
  5235. return false
  5236. }
  5237. function activateChildComponent (vm, direct) {
  5238. if (direct) {
  5239. vm._directInactive = false;
  5240. if (isInInactiveTree(vm)) {
  5241. return
  5242. }
  5243. } else if (vm._directInactive) {
  5244. return
  5245. }
  5246. if (vm._inactive || vm._inactive === null) {
  5247. vm._inactive = false;
  5248. for (var i = 0; i < vm.$children.length; i++) {
  5249. activateChildComponent(vm.$children[i]);
  5250. }
  5251. callHook(vm, 'activated');
  5252. }
  5253. }
  5254. function deactivateChildComponent (vm, direct) {
  5255. if (direct) {
  5256. vm._directInactive = true;
  5257. if (isInInactiveTree(vm)) {
  5258. return
  5259. }
  5260. }
  5261. if (!vm._inactive) {
  5262. vm._inactive = true;
  5263. for (var i = 0; i < vm.$children.length; i++) {
  5264. deactivateChildComponent(vm.$children[i]);
  5265. }
  5266. callHook(vm, 'deactivated');
  5267. }
  5268. }
  5269. function callHook (vm, hook) {
  5270. // #7573 disable dep collection when invoking lifecycle hooks
  5271. pushTarget();
  5272. var handlers = vm.$options[hook];
  5273. var info = hook + " hook";
  5274. if (handlers) {
  5275. for (var i = 0, j = handlers.length; i < j; i++) {
  5276. invokeWithErrorHandling(handlers[i], vm, null, vm, info);
  5277. }
  5278. }
  5279. if (vm._hasHookEvent) {
  5280. vm.$emit('hook:' + hook);
  5281. }
  5282. popTarget();
  5283. }
  5284. /* */
  5285. var MAX_UPDATE_COUNT = 100;
  5286. var queue = [];
  5287. var activatedChildren = [];
  5288. var has = {};
  5289. var circular = {};
  5290. var waiting = false;
  5291. var flushing = false;
  5292. var index = 0;
  5293. /**
  5294. * Reset the scheduler's state.
  5295. */
  5296. function resetSchedulerState () {
  5297. index = queue.length = activatedChildren.length = 0;
  5298. has = {};
  5299. if (true) {
  5300. circular = {};
  5301. }
  5302. waiting = flushing = false;
  5303. }
  5304. // Async edge case #6566 requires saving the timestamp when event listeners are
  5305. // attached. However, calling performance.now() has a perf overhead especially
  5306. // if the page has thousands of event listeners. Instead, we take a timestamp
  5307. // every time the scheduler flushes and use that for all event listeners
  5308. // attached during that flush.
  5309. var currentFlushTimestamp = 0;
  5310. // Async edge case fix requires storing an event listener's attach timestamp.
  5311. var getNow = Date.now;
  5312. // Determine what event timestamp the browser is using. Annoyingly, the
  5313. // timestamp can either be hi-res (relative to page load) or low-res
  5314. // (relative to UNIX epoch), so in order to compare time we have to use the
  5315. // same timestamp type when saving the flush timestamp.
  5316. // All IE versions use low-res event timestamps, and have problematic clock
  5317. // implementations (#9632)
  5318. if (inBrowser && !isIE) {
  5319. var performance = window.performance;
  5320. if (
  5321. performance &&
  5322. typeof performance.now === 'function' &&
  5323. getNow() > document.createEvent('Event').timeStamp
  5324. ) {
  5325. // if the event timestamp, although evaluated AFTER the Date.now(), is
  5326. // smaller than it, it means the event is using a hi-res timestamp,
  5327. // and we need to use the hi-res version for event listener timestamps as
  5328. // well.
  5329. getNow = function () { return performance.now(); };
  5330. }
  5331. }
  5332. /**
  5333. * Flush both queues and run the watchers.
  5334. */
  5335. function flushSchedulerQueue () {
  5336. currentFlushTimestamp = getNow();
  5337. flushing = true;
  5338. var watcher, id;
  5339. // Sort queue before flush.
  5340. // This ensures that:
  5341. // 1. Components are updated from parent to child. (because parent is always
  5342. // created before the child)
  5343. // 2. A component's user watchers are run before its render watcher (because
  5344. // user watchers are created before the render watcher)
  5345. // 3. If a component is destroyed during a parent component's watcher run,
  5346. // its watchers can be skipped.
  5347. queue.sort(function (a, b) { return a.id - b.id; });
  5348. // do not cache length because more watchers might be pushed
  5349. // as we run existing watchers
  5350. for (index = 0; index < queue.length; index++) {
  5351. watcher = queue[index];
  5352. if (watcher.before) {
  5353. watcher.before();
  5354. }
  5355. id = watcher.id;
  5356. has[id] = null;
  5357. watcher.run();
  5358. // in dev build, check and stop circular updates.
  5359. if ( true && has[id] != null) {
  5360. circular[id] = (circular[id] || 0) + 1;
  5361. if (circular[id] > MAX_UPDATE_COUNT) {
  5362. warn(
  5363. 'You may have an infinite update loop ' + (
  5364. watcher.user
  5365. ? ("in watcher with expression \"" + (watcher.expression) + "\"")
  5366. : "in a component render function."
  5367. ),
  5368. watcher.vm
  5369. );
  5370. break
  5371. }
  5372. }
  5373. }
  5374. // keep copies of post queues before resetting state
  5375. var activatedQueue = activatedChildren.slice();
  5376. var updatedQueue = queue.slice();
  5377. resetSchedulerState();
  5378. // call component updated and activated hooks
  5379. callActivatedHooks(activatedQueue);
  5380. callUpdatedHooks(updatedQueue);
  5381. // devtool hook
  5382. /* istanbul ignore if */
  5383. if (devtools && config.devtools) {
  5384. devtools.emit('flush');
  5385. }
  5386. }
  5387. function callUpdatedHooks (queue) {
  5388. var i = queue.length;
  5389. while (i--) {
  5390. var watcher = queue[i];
  5391. var vm = watcher.vm;
  5392. if (vm._watcher === watcher && vm._isMounted && !vm._isDestroyed) {
  5393. callHook(vm, 'updated');
  5394. }
  5395. }
  5396. }
  5397. /**
  5398. * Queue a kept-alive component that was activated during patch.
  5399. * The queue will be processed after the entire tree has been patched.
  5400. */
  5401. function queueActivatedComponent (vm) {
  5402. // setting _inactive to false here so that a render function can
  5403. // rely on checking whether it's in an inactive tree (e.g. router-view)
  5404. vm._inactive = false;
  5405. activatedChildren.push(vm);
  5406. }
  5407. function callActivatedHooks (queue) {
  5408. for (var i = 0; i < queue.length; i++) {
  5409. queue[i]._inactive = true;
  5410. activateChildComponent(queue[i], true /* true */);
  5411. }
  5412. }
  5413. /**
  5414. * Push a watcher into the watcher queue.
  5415. * Jobs with duplicate IDs will be skipped unless it's
  5416. * pushed when the queue is being flushed.
  5417. */
  5418. function queueWatcher (watcher) {
  5419. var id = watcher.id;
  5420. if (has[id] == null) {
  5421. has[id] = true;
  5422. if (!flushing) {
  5423. queue.push(watcher);
  5424. } else {
  5425. // if already flushing, splice the watcher based on its id
  5426. // if already past its id, it will be run next immediately.
  5427. var i = queue.length - 1;
  5428. while (i > index && queue[i].id > watcher.id) {
  5429. i--;
  5430. }
  5431. queue.splice(i + 1, 0, watcher);
  5432. }
  5433. // queue the flush
  5434. if (!waiting) {
  5435. waiting = true;
  5436. if ( true && !config.async) {
  5437. flushSchedulerQueue();
  5438. return
  5439. }
  5440. nextTick(flushSchedulerQueue);
  5441. }
  5442. }
  5443. }
  5444. /* */
  5445. var uid$2 = 0;
  5446. /**
  5447. * A watcher parses an expression, collects dependencies,
  5448. * and fires callback when the expression value changes.
  5449. * This is used for both the $watch() api and directives.
  5450. */
  5451. var Watcher = function Watcher (
  5452. vm,
  5453. expOrFn,
  5454. cb,
  5455. options,
  5456. isRenderWatcher
  5457. ) {
  5458. this.vm = vm;
  5459. if (isRenderWatcher) {
  5460. vm._watcher = this;
  5461. }
  5462. vm._watchers.push(this);
  5463. // options
  5464. if (options) {
  5465. this.deep = !!options.deep;
  5466. this.user = !!options.user;
  5467. this.lazy = !!options.lazy;
  5468. this.sync = !!options.sync;
  5469. this.before = options.before;
  5470. } else {
  5471. this.deep = this.user = this.lazy = this.sync = false;
  5472. }
  5473. this.cb = cb;
  5474. this.id = ++uid$2; // uid for batching
  5475. this.active = true;
  5476. this.dirty = this.lazy; // for lazy watchers
  5477. this.deps = [];
  5478. this.newDeps = [];
  5479. this.depIds = new _Set();
  5480. this.newDepIds = new _Set();
  5481. this.expression = true
  5482. ? expOrFn.toString()
  5483. : undefined;
  5484. // parse expression for getter
  5485. if (typeof expOrFn === 'function') {
  5486. this.getter = expOrFn;
  5487. } else {
  5488. this.getter = parsePath(expOrFn);
  5489. if (!this.getter) {
  5490. this.getter = noop;
  5491. true && warn(
  5492. "Failed watching path: \"" + expOrFn + "\" " +
  5493. 'Watcher only accepts simple dot-delimited paths. ' +
  5494. 'For full control, use a function instead.',
  5495. vm
  5496. );
  5497. }
  5498. }
  5499. this.value = this.lazy
  5500. ? undefined
  5501. : this.get();
  5502. };
  5503. /**
  5504. * Evaluate the getter, and re-collect dependencies.
  5505. */
  5506. Watcher.prototype.get = function get () {
  5507. pushTarget(this);
  5508. var value;
  5509. var vm = this.vm;
  5510. try {
  5511. value = this.getter.call(vm, vm);
  5512. } catch (e) {
  5513. if (this.user) {
  5514. handleError(e, vm, ("getter for watcher \"" + (this.expression) + "\""));
  5515. } else {
  5516. throw e
  5517. }
  5518. } finally {
  5519. // "touch" every property so they are all tracked as
  5520. // dependencies for deep watching
  5521. if (this.deep) {
  5522. traverse(value);
  5523. }
  5524. popTarget();
  5525. this.cleanupDeps();
  5526. }
  5527. return value
  5528. };
  5529. /**
  5530. * Add a dependency to this directive.
  5531. */
  5532. Watcher.prototype.addDep = function addDep (dep) {
  5533. var id = dep.id;
  5534. if (!this.newDepIds.has(id)) {
  5535. this.newDepIds.add(id);
  5536. this.newDeps.push(dep);
  5537. if (!this.depIds.has(id)) {
  5538. dep.addSub(this);
  5539. }
  5540. }
  5541. };
  5542. /**
  5543. * Clean up for dependency collection.
  5544. */
  5545. Watcher.prototype.cleanupDeps = function cleanupDeps () {
  5546. var i = this.deps.length;
  5547. while (i--) {
  5548. var dep = this.deps[i];
  5549. if (!this.newDepIds.has(dep.id)) {
  5550. dep.removeSub(this);
  5551. }
  5552. }
  5553. var tmp = this.depIds;
  5554. this.depIds = this.newDepIds;
  5555. this.newDepIds = tmp;
  5556. this.newDepIds.clear();
  5557. tmp = this.deps;
  5558. this.deps = this.newDeps;
  5559. this.newDeps = tmp;
  5560. this.newDeps.length = 0;
  5561. };
  5562. /**
  5563. * Subscriber interface.
  5564. * Will be called when a dependency changes.
  5565. */
  5566. Watcher.prototype.update = function update () {
  5567. /* istanbul ignore else */
  5568. if (this.lazy) {
  5569. this.dirty = true;
  5570. } else if (this.sync) {
  5571. this.run();
  5572. } else {
  5573. queueWatcher(this);
  5574. }
  5575. };
  5576. /**
  5577. * Scheduler job interface.
  5578. * Will be called by the scheduler.
  5579. */
  5580. Watcher.prototype.run = function run () {
  5581. if (this.active) {
  5582. var value = this.get();
  5583. if (
  5584. value !== this.value ||
  5585. // Deep watchers and watchers on Object/Arrays should fire even
  5586. // when the value is the same, because the value may
  5587. // have mutated.
  5588. isObject(value) ||
  5589. this.deep
  5590. ) {
  5591. // set new value
  5592. var oldValue = this.value;
  5593. this.value = value;
  5594. if (this.user) {
  5595. try {
  5596. this.cb.call(this.vm, value, oldValue);
  5597. } catch (e) {
  5598. handleError(e, this.vm, ("callback for watcher \"" + (this.expression) + "\""));
  5599. }
  5600. } else {
  5601. this.cb.call(this.vm, value, oldValue);
  5602. }
  5603. }
  5604. }
  5605. };
  5606. /**
  5607. * Evaluate the value of the watcher.
  5608. * This only gets called for lazy watchers.
  5609. */
  5610. Watcher.prototype.evaluate = function evaluate () {
  5611. this.value = this.get();
  5612. this.dirty = false;
  5613. };
  5614. /**
  5615. * Depend on all deps collected by this watcher.
  5616. */
  5617. Watcher.prototype.depend = function depend () {
  5618. var i = this.deps.length;
  5619. while (i--) {
  5620. this.deps[i].depend();
  5621. }
  5622. };
  5623. /**
  5624. * Remove self from all dependencies' subscriber list.
  5625. */
  5626. Watcher.prototype.teardown = function teardown () {
  5627. if (this.active) {
  5628. // remove self from vm's watcher list
  5629. // this is a somewhat expensive operation so we skip it
  5630. // if the vm is being destroyed.
  5631. if (!this.vm._isBeingDestroyed) {
  5632. remove(this.vm._watchers, this);
  5633. }
  5634. var i = this.deps.length;
  5635. while (i--) {
  5636. this.deps[i].removeSub(this);
  5637. }
  5638. this.active = false;
  5639. }
  5640. };
  5641. /* */
  5642. var sharedPropertyDefinition = {
  5643. enumerable: true,
  5644. configurable: true,
  5645. get: noop,
  5646. set: noop
  5647. };
  5648. function proxy (target, sourceKey, key) {
  5649. sharedPropertyDefinition.get = function proxyGetter () {
  5650. return this[sourceKey][key]
  5651. };
  5652. sharedPropertyDefinition.set = function proxySetter (val) {
  5653. this[sourceKey][key] = val;
  5654. };
  5655. Object.defineProperty(target, key, sharedPropertyDefinition);
  5656. }
  5657. function initState (vm) {
  5658. vm._watchers = [];
  5659. var opts = vm.$options;
  5660. if (opts.props) { initProps(vm, opts.props); }
  5661. if (opts.methods) { initMethods(vm, opts.methods); }
  5662. if (opts.data) {
  5663. initData(vm);
  5664. } else {
  5665. observe(vm._data = {}, true /* asRootData */);
  5666. }
  5667. if (opts.computed) { initComputed(vm, opts.computed); }
  5668. if (opts.watch && opts.watch !== nativeWatch) {
  5669. initWatch(vm, opts.watch);
  5670. }
  5671. }
  5672. function initProps (vm, propsOptions) {
  5673. var propsData = vm.$options.propsData || {};
  5674. var props = vm._props = {};
  5675. // cache prop keys so that future props updates can iterate using Array
  5676. // instead of dynamic object key enumeration.
  5677. var keys = vm.$options._propKeys = [];
  5678. var isRoot = !vm.$parent;
  5679. // root instance props should be converted
  5680. if (!isRoot) {
  5681. toggleObserving(false);
  5682. }
  5683. var loop = function ( key ) {
  5684. keys.push(key);
  5685. var value = validateProp(key, propsOptions, propsData, vm);
  5686. /* istanbul ignore else */
  5687. if (true) {
  5688. var hyphenatedKey = hyphenate(key);
  5689. if (isReservedAttribute(hyphenatedKey) ||
  5690. config.isReservedAttr(hyphenatedKey)) {
  5691. warn(
  5692. ("\"" + hyphenatedKey + "\" is a reserved attribute and cannot be used as component prop."),
  5693. vm
  5694. );
  5695. }
  5696. defineReactive$$1(props, key, value, function () {
  5697. if (!isRoot && !isUpdatingChildComponent) {
  5698. {
  5699. if(vm.mpHost === 'mp-baidu'){//百度 observer 在 setData callback 之后触发,直接忽略该 warn
  5700. return
  5701. }
  5702. //fixed by xxxxxx __next_tick_pending,uni://form-field 时不告警
  5703. if(
  5704. key === 'value' &&
  5705. Array.isArray(vm.$options.behaviors) &&
  5706. vm.$options.behaviors.indexOf('uni://form-field') !== -1
  5707. ){
  5708. return
  5709. }
  5710. if(vm._getFormData){
  5711. return
  5712. }
  5713. var $parent = vm.$parent;
  5714. while($parent){
  5715. if($parent.__next_tick_pending){
  5716. return
  5717. }
  5718. $parent = $parent.$parent;
  5719. }
  5720. }
  5721. warn(
  5722. "Avoid mutating a prop directly since the value will be " +
  5723. "overwritten whenever the parent component re-renders. " +
  5724. "Instead, use a data or computed property based on the prop's " +
  5725. "value. Prop being mutated: \"" + key + "\"",
  5726. vm
  5727. );
  5728. }
  5729. });
  5730. } else {}
  5731. // static props are already proxied on the component's prototype
  5732. // during Vue.extend(). We only need to proxy props defined at
  5733. // instantiation here.
  5734. if (!(key in vm)) {
  5735. proxy(vm, "_props", key);
  5736. }
  5737. };
  5738. for (var key in propsOptions) loop( key );
  5739. toggleObserving(true);
  5740. }
  5741. function initData (vm) {
  5742. var data = vm.$options.data;
  5743. data = vm._data = typeof data === 'function'
  5744. ? getData(data, vm)
  5745. : data || {};
  5746. if (!isPlainObject(data)) {
  5747. data = {};
  5748. true && warn(
  5749. 'data functions should return an object:\n' +
  5750. 'https://vuejs.org/v2/guide/components.html#data-Must-Be-a-Function',
  5751. vm
  5752. );
  5753. }
  5754. // proxy data on instance
  5755. var keys = Object.keys(data);
  5756. var props = vm.$options.props;
  5757. var methods = vm.$options.methods;
  5758. var i = keys.length;
  5759. while (i--) {
  5760. var key = keys[i];
  5761. if (true) {
  5762. if (methods && hasOwn(methods, key)) {
  5763. warn(
  5764. ("Method \"" + key + "\" has already been defined as a data property."),
  5765. vm
  5766. );
  5767. }
  5768. }
  5769. if (props && hasOwn(props, key)) {
  5770. true && warn(
  5771. "The data property \"" + key + "\" is already declared as a prop. " +
  5772. "Use prop default value instead.",
  5773. vm
  5774. );
  5775. } else if (!isReserved(key)) {
  5776. proxy(vm, "_data", key);
  5777. }
  5778. }
  5779. // observe data
  5780. observe(data, true /* asRootData */);
  5781. }
  5782. function getData (data, vm) {
  5783. // #7573 disable dep collection when invoking data getters
  5784. pushTarget();
  5785. try {
  5786. return data.call(vm, vm)
  5787. } catch (e) {
  5788. handleError(e, vm, "data()");
  5789. return {}
  5790. } finally {
  5791. popTarget();
  5792. }
  5793. }
  5794. var computedWatcherOptions = { lazy: true };
  5795. function initComputed (vm, computed) {
  5796. // $flow-disable-line
  5797. var watchers = vm._computedWatchers = Object.create(null);
  5798. // computed properties are just getters during SSR
  5799. var isSSR = isServerRendering();
  5800. for (var key in computed) {
  5801. var userDef = computed[key];
  5802. var getter = typeof userDef === 'function' ? userDef : userDef.get;
  5803. if ( true && getter == null) {
  5804. warn(
  5805. ("Getter is missing for computed property \"" + key + "\"."),
  5806. vm
  5807. );
  5808. }
  5809. if (!isSSR) {
  5810. // create internal watcher for the computed property.
  5811. watchers[key] = new Watcher(
  5812. vm,
  5813. getter || noop,
  5814. noop,
  5815. computedWatcherOptions
  5816. );
  5817. }
  5818. // component-defined computed properties are already defined on the
  5819. // component prototype. We only need to define computed properties defined
  5820. // at instantiation here.
  5821. if (!(key in vm)) {
  5822. defineComputed(vm, key, userDef);
  5823. } else if (true) {
  5824. if (key in vm.$data) {
  5825. warn(("The computed property \"" + key + "\" is already defined in data."), vm);
  5826. } else if (vm.$options.props && key in vm.$options.props) {
  5827. warn(("The computed property \"" + key + "\" is already defined as a prop."), vm);
  5828. }
  5829. }
  5830. }
  5831. }
  5832. function defineComputed (
  5833. target,
  5834. key,
  5835. userDef
  5836. ) {
  5837. var shouldCache = !isServerRendering();
  5838. if (typeof userDef === 'function') {
  5839. sharedPropertyDefinition.get = shouldCache
  5840. ? createComputedGetter(key)
  5841. : createGetterInvoker(userDef);
  5842. sharedPropertyDefinition.set = noop;
  5843. } else {
  5844. sharedPropertyDefinition.get = userDef.get
  5845. ? shouldCache && userDef.cache !== false
  5846. ? createComputedGetter(key)
  5847. : createGetterInvoker(userDef.get)
  5848. : noop;
  5849. sharedPropertyDefinition.set = userDef.set || noop;
  5850. }
  5851. if ( true &&
  5852. sharedPropertyDefinition.set === noop) {
  5853. sharedPropertyDefinition.set = function () {
  5854. warn(
  5855. ("Computed property \"" + key + "\" was assigned to but it has no setter."),
  5856. this
  5857. );
  5858. };
  5859. }
  5860. Object.defineProperty(target, key, sharedPropertyDefinition);
  5861. }
  5862. function createComputedGetter (key) {
  5863. return function computedGetter () {
  5864. var watcher = this._computedWatchers && this._computedWatchers[key];
  5865. if (watcher) {
  5866. if (watcher.dirty) {
  5867. watcher.evaluate();
  5868. }
  5869. if (Dep.SharedObject.target) {// fixed by xxxxxx
  5870. watcher.depend();
  5871. }
  5872. return watcher.value
  5873. }
  5874. }
  5875. }
  5876. function createGetterInvoker(fn) {
  5877. return function computedGetter () {
  5878. return fn.call(this, this)
  5879. }
  5880. }
  5881. function initMethods (vm, methods) {
  5882. var props = vm.$options.props;
  5883. for (var key in methods) {
  5884. if (true) {
  5885. if (typeof methods[key] !== 'function') {
  5886. warn(
  5887. "Method \"" + key + "\" has type \"" + (typeof methods[key]) + "\" in the component definition. " +
  5888. "Did you reference the function correctly?",
  5889. vm
  5890. );
  5891. }
  5892. if (props && hasOwn(props, key)) {
  5893. warn(
  5894. ("Method \"" + key + "\" has already been defined as a prop."),
  5895. vm
  5896. );
  5897. }
  5898. if ((key in vm) && isReserved(key)) {
  5899. warn(
  5900. "Method \"" + key + "\" conflicts with an existing Vue instance method. " +
  5901. "Avoid defining component methods that start with _ or $."
  5902. );
  5903. }
  5904. }
  5905. vm[key] = typeof methods[key] !== 'function' ? noop : bind(methods[key], vm);
  5906. }
  5907. }
  5908. function initWatch (vm, watch) {
  5909. for (var key in watch) {
  5910. var handler = watch[key];
  5911. if (Array.isArray(handler)) {
  5912. for (var i = 0; i < handler.length; i++) {
  5913. createWatcher(vm, key, handler[i]);
  5914. }
  5915. } else {
  5916. createWatcher(vm, key, handler);
  5917. }
  5918. }
  5919. }
  5920. function createWatcher (
  5921. vm,
  5922. expOrFn,
  5923. handler,
  5924. options
  5925. ) {
  5926. if (isPlainObject(handler)) {
  5927. options = handler;
  5928. handler = handler.handler;
  5929. }
  5930. if (typeof handler === 'string') {
  5931. handler = vm[handler];
  5932. }
  5933. return vm.$watch(expOrFn, handler, options)
  5934. }
  5935. function stateMixin (Vue) {
  5936. // flow somehow has problems with directly declared definition object
  5937. // when using Object.defineProperty, so we have to procedurally build up
  5938. // the object here.
  5939. var dataDef = {};
  5940. dataDef.get = function () { return this._data };
  5941. var propsDef = {};
  5942. propsDef.get = function () { return this._props };
  5943. if (true) {
  5944. dataDef.set = function () {
  5945. warn(
  5946. 'Avoid replacing instance root $data. ' +
  5947. 'Use nested data properties instead.',
  5948. this
  5949. );
  5950. };
  5951. propsDef.set = function () {
  5952. warn("$props is readonly.", this);
  5953. };
  5954. }
  5955. Object.defineProperty(Vue.prototype, '$data', dataDef);
  5956. Object.defineProperty(Vue.prototype, '$props', propsDef);
  5957. Vue.prototype.$set = set;
  5958. Vue.prototype.$delete = del;
  5959. Vue.prototype.$watch = function (
  5960. expOrFn,
  5961. cb,
  5962. options
  5963. ) {
  5964. var vm = this;
  5965. if (isPlainObject(cb)) {
  5966. return createWatcher(vm, expOrFn, cb, options)
  5967. }
  5968. options = options || {};
  5969. options.user = true;
  5970. var watcher = new Watcher(vm, expOrFn, cb, options);
  5971. if (options.immediate) {
  5972. try {
  5973. cb.call(vm, watcher.value);
  5974. } catch (error) {
  5975. handleError(error, vm, ("callback for immediate watcher \"" + (watcher.expression) + "\""));
  5976. }
  5977. }
  5978. return function unwatchFn () {
  5979. watcher.teardown();
  5980. }
  5981. };
  5982. }
  5983. /* */
  5984. var uid$3 = 0;
  5985. function initMixin (Vue) {
  5986. Vue.prototype._init = function (options) {
  5987. var vm = this;
  5988. // a uid
  5989. vm._uid = uid$3++;
  5990. var startTag, endTag;
  5991. /* istanbul ignore if */
  5992. if ( true && config.performance && mark) {
  5993. startTag = "vue-perf-start:" + (vm._uid);
  5994. endTag = "vue-perf-end:" + (vm._uid);
  5995. mark(startTag);
  5996. }
  5997. // a flag to avoid this being observed
  5998. vm._isVue = true;
  5999. // merge options
  6000. if (options && options._isComponent) {
  6001. // optimize internal component instantiation
  6002. // since dynamic options merging is pretty slow, and none of the
  6003. // internal component options needs special treatment.
  6004. initInternalComponent(vm, options);
  6005. } else {
  6006. vm.$options = mergeOptions(
  6007. resolveConstructorOptions(vm.constructor),
  6008. options || {},
  6009. vm
  6010. );
  6011. }
  6012. /* istanbul ignore else */
  6013. if (true) {
  6014. initProxy(vm);
  6015. } else {}
  6016. // expose real self
  6017. vm._self = vm;
  6018. initLifecycle(vm);
  6019. initEvents(vm);
  6020. initRender(vm);
  6021. callHook(vm, 'beforeCreate');
  6022. !vm._$fallback && initInjections(vm); // resolve injections before data/props
  6023. initState(vm);
  6024. !vm._$fallback && initProvide(vm); // resolve provide after data/props
  6025. !vm._$fallback && callHook(vm, 'created');
  6026. /* istanbul ignore if */
  6027. if ( true && config.performance && mark) {
  6028. vm._name = formatComponentName(vm, false);
  6029. mark(endTag);
  6030. measure(("vue " + (vm._name) + " init"), startTag, endTag);
  6031. }
  6032. if (vm.$options.el) {
  6033. vm.$mount(vm.$options.el);
  6034. }
  6035. };
  6036. }
  6037. function initInternalComponent (vm, options) {
  6038. var opts = vm.$options = Object.create(vm.constructor.options);
  6039. // doing this because it's faster than dynamic enumeration.
  6040. var parentVnode = options._parentVnode;
  6041. opts.parent = options.parent;
  6042. opts._parentVnode = parentVnode;
  6043. var vnodeComponentOptions = parentVnode.componentOptions;
  6044. opts.propsData = vnodeComponentOptions.propsData;
  6045. opts._parentListeners = vnodeComponentOptions.listeners;
  6046. opts._renderChildren = vnodeComponentOptions.children;
  6047. opts._componentTag = vnodeComponentOptions.tag;
  6048. if (options.render) {
  6049. opts.render = options.render;
  6050. opts.staticRenderFns = options.staticRenderFns;
  6051. }
  6052. }
  6053. function resolveConstructorOptions (Ctor) {
  6054. var options = Ctor.options;
  6055. if (Ctor.super) {
  6056. var superOptions = resolveConstructorOptions(Ctor.super);
  6057. var cachedSuperOptions = Ctor.superOptions;
  6058. if (superOptions !== cachedSuperOptions) {
  6059. // super option changed,
  6060. // need to resolve new options.
  6061. Ctor.superOptions = superOptions;
  6062. // check if there are any late-modified/attached options (#4976)
  6063. var modifiedOptions = resolveModifiedOptions(Ctor);
  6064. // update base extend options
  6065. if (modifiedOptions) {
  6066. extend(Ctor.extendOptions, modifiedOptions);
  6067. }
  6068. options = Ctor.options = mergeOptions(superOptions, Ctor.extendOptions);
  6069. if (options.name) {
  6070. options.components[options.name] = Ctor;
  6071. }
  6072. }
  6073. }
  6074. return options
  6075. }
  6076. function resolveModifiedOptions (Ctor) {
  6077. var modified;
  6078. var latest = Ctor.options;
  6079. var sealed = Ctor.sealedOptions;
  6080. for (var key in latest) {
  6081. if (latest[key] !== sealed[key]) {
  6082. if (!modified) { modified = {}; }
  6083. modified[key] = latest[key];
  6084. }
  6085. }
  6086. return modified
  6087. }
  6088. function Vue (options) {
  6089. if ( true &&
  6090. !(this instanceof Vue)
  6091. ) {
  6092. warn('Vue is a constructor and should be called with the `new` keyword');
  6093. }
  6094. this._init(options);
  6095. }
  6096. initMixin(Vue);
  6097. stateMixin(Vue);
  6098. eventsMixin(Vue);
  6099. lifecycleMixin(Vue);
  6100. renderMixin(Vue);
  6101. /* */
  6102. function initUse (Vue) {
  6103. Vue.use = function (plugin) {
  6104. var installedPlugins = (this._installedPlugins || (this._installedPlugins = []));
  6105. if (installedPlugins.indexOf(plugin) > -1) {
  6106. return this
  6107. }
  6108. // additional parameters
  6109. var args = toArray(arguments, 1);
  6110. args.unshift(this);
  6111. if (typeof plugin.install === 'function') {
  6112. plugin.install.apply(plugin, args);
  6113. } else if (typeof plugin === 'function') {
  6114. plugin.apply(null, args);
  6115. }
  6116. installedPlugins.push(plugin);
  6117. return this
  6118. };
  6119. }
  6120. /* */
  6121. function initMixin$1 (Vue) {
  6122. Vue.mixin = function (mixin) {
  6123. this.options = mergeOptions(this.options, mixin);
  6124. return this
  6125. };
  6126. }
  6127. /* */
  6128. function initExtend (Vue) {
  6129. /**
  6130. * Each instance constructor, including Vue, has a unique
  6131. * cid. This enables us to create wrapped "child
  6132. * constructors" for prototypal inheritance and cache them.
  6133. */
  6134. Vue.cid = 0;
  6135. var cid = 1;
  6136. /**
  6137. * Class inheritance
  6138. */
  6139. Vue.extend = function (extendOptions) {
  6140. extendOptions = extendOptions || {};
  6141. var Super = this;
  6142. var SuperId = Super.cid;
  6143. var cachedCtors = extendOptions._Ctor || (extendOptions._Ctor = {});
  6144. if (cachedCtors[SuperId]) {
  6145. return cachedCtors[SuperId]
  6146. }
  6147. var name = extendOptions.name || Super.options.name;
  6148. if ( true && name) {
  6149. validateComponentName(name);
  6150. }
  6151. var Sub = function VueComponent (options) {
  6152. this._init(options);
  6153. };
  6154. Sub.prototype = Object.create(Super.prototype);
  6155. Sub.prototype.constructor = Sub;
  6156. Sub.cid = cid++;
  6157. Sub.options = mergeOptions(
  6158. Super.options,
  6159. extendOptions
  6160. );
  6161. Sub['super'] = Super;
  6162. // For props and computed properties, we define the proxy getters on
  6163. // the Vue instances at extension time, on the extended prototype. This
  6164. // avoids Object.defineProperty calls for each instance created.
  6165. if (Sub.options.props) {
  6166. initProps$1(Sub);
  6167. }
  6168. if (Sub.options.computed) {
  6169. initComputed$1(Sub);
  6170. }
  6171. // allow further extension/mixin/plugin usage
  6172. Sub.extend = Super.extend;
  6173. Sub.mixin = Super.mixin;
  6174. Sub.use = Super.use;
  6175. // create asset registers, so extended classes
  6176. // can have their private assets too.
  6177. ASSET_TYPES.forEach(function (type) {
  6178. Sub[type] = Super[type];
  6179. });
  6180. // enable recursive self-lookup
  6181. if (name) {
  6182. Sub.options.components[name] = Sub;
  6183. }
  6184. // keep a reference to the super options at extension time.
  6185. // later at instantiation we can check if Super's options have
  6186. // been updated.
  6187. Sub.superOptions = Super.options;
  6188. Sub.extendOptions = extendOptions;
  6189. Sub.sealedOptions = extend({}, Sub.options);
  6190. // cache constructor
  6191. cachedCtors[SuperId] = Sub;
  6192. return Sub
  6193. };
  6194. }
  6195. function initProps$1 (Comp) {
  6196. var props = Comp.options.props;
  6197. for (var key in props) {
  6198. proxy(Comp.prototype, "_props", key);
  6199. }
  6200. }
  6201. function initComputed$1 (Comp) {
  6202. var computed = Comp.options.computed;
  6203. for (var key in computed) {
  6204. defineComputed(Comp.prototype, key, computed[key]);
  6205. }
  6206. }
  6207. /* */
  6208. function initAssetRegisters (Vue) {
  6209. /**
  6210. * Create asset registration methods.
  6211. */
  6212. ASSET_TYPES.forEach(function (type) {
  6213. Vue[type] = function (
  6214. id,
  6215. definition
  6216. ) {
  6217. if (!definition) {
  6218. return this.options[type + 's'][id]
  6219. } else {
  6220. /* istanbul ignore if */
  6221. if ( true && type === 'component') {
  6222. validateComponentName(id);
  6223. }
  6224. if (type === 'component' && isPlainObject(definition)) {
  6225. definition.name = definition.name || id;
  6226. definition = this.options._base.extend(definition);
  6227. }
  6228. if (type === 'directive' && typeof definition === 'function') {
  6229. definition = { bind: definition, update: definition };
  6230. }
  6231. this.options[type + 's'][id] = definition;
  6232. return definition
  6233. }
  6234. };
  6235. });
  6236. }
  6237. /* */
  6238. function getComponentName (opts) {
  6239. return opts && (opts.Ctor.options.name || opts.tag)
  6240. }
  6241. function matches (pattern, name) {
  6242. if (Array.isArray(pattern)) {
  6243. return pattern.indexOf(name) > -1
  6244. } else if (typeof pattern === 'string') {
  6245. return pattern.split(',').indexOf(name) > -1
  6246. } else if (isRegExp(pattern)) {
  6247. return pattern.test(name)
  6248. }
  6249. /* istanbul ignore next */
  6250. return false
  6251. }
  6252. function pruneCache (keepAliveInstance, filter) {
  6253. var cache = keepAliveInstance.cache;
  6254. var keys = keepAliveInstance.keys;
  6255. var _vnode = keepAliveInstance._vnode;
  6256. for (var key in cache) {
  6257. var cachedNode = cache[key];
  6258. if (cachedNode) {
  6259. var name = getComponentName(cachedNode.componentOptions);
  6260. if (name && !filter(name)) {
  6261. pruneCacheEntry(cache, key, keys, _vnode);
  6262. }
  6263. }
  6264. }
  6265. }
  6266. function pruneCacheEntry (
  6267. cache,
  6268. key,
  6269. keys,
  6270. current
  6271. ) {
  6272. var cached$$1 = cache[key];
  6273. if (cached$$1 && (!current || cached$$1.tag !== current.tag)) {
  6274. cached$$1.componentInstance.$destroy();
  6275. }
  6276. cache[key] = null;
  6277. remove(keys, key);
  6278. }
  6279. var patternTypes = [String, RegExp, Array];
  6280. var KeepAlive = {
  6281. name: 'keep-alive',
  6282. abstract: true,
  6283. props: {
  6284. include: patternTypes,
  6285. exclude: patternTypes,
  6286. max: [String, Number]
  6287. },
  6288. created: function created () {
  6289. this.cache = Object.create(null);
  6290. this.keys = [];
  6291. },
  6292. destroyed: function destroyed () {
  6293. for (var key in this.cache) {
  6294. pruneCacheEntry(this.cache, key, this.keys);
  6295. }
  6296. },
  6297. mounted: function mounted () {
  6298. var this$1 = this;
  6299. this.$watch('include', function (val) {
  6300. pruneCache(this$1, function (name) { return matches(val, name); });
  6301. });
  6302. this.$watch('exclude', function (val) {
  6303. pruneCache(this$1, function (name) { return !matches(val, name); });
  6304. });
  6305. },
  6306. render: function render () {
  6307. var slot = this.$slots.default;
  6308. var vnode = getFirstComponentChild(slot);
  6309. var componentOptions = vnode && vnode.componentOptions;
  6310. if (componentOptions) {
  6311. // check pattern
  6312. var name = getComponentName(componentOptions);
  6313. var ref = this;
  6314. var include = ref.include;
  6315. var exclude = ref.exclude;
  6316. if (
  6317. // not included
  6318. (include && (!name || !matches(include, name))) ||
  6319. // excluded
  6320. (exclude && name && matches(exclude, name))
  6321. ) {
  6322. return vnode
  6323. }
  6324. var ref$1 = this;
  6325. var cache = ref$1.cache;
  6326. var keys = ref$1.keys;
  6327. var key = vnode.key == null
  6328. // same constructor may get registered as different local components
  6329. // so cid alone is not enough (#3269)
  6330. ? componentOptions.Ctor.cid + (componentOptions.tag ? ("::" + (componentOptions.tag)) : '')
  6331. : vnode.key;
  6332. if (cache[key]) {
  6333. vnode.componentInstance = cache[key].componentInstance;
  6334. // make current key freshest
  6335. remove(keys, key);
  6336. keys.push(key);
  6337. } else {
  6338. cache[key] = vnode;
  6339. keys.push(key);
  6340. // prune oldest entry
  6341. if (this.max && keys.length > parseInt(this.max)) {
  6342. pruneCacheEntry(cache, keys[0], keys, this._vnode);
  6343. }
  6344. }
  6345. vnode.data.keepAlive = true;
  6346. }
  6347. return vnode || (slot && slot[0])
  6348. }
  6349. };
  6350. var builtInComponents = {
  6351. KeepAlive: KeepAlive
  6352. };
  6353. /* */
  6354. function initGlobalAPI (Vue) {
  6355. // config
  6356. var configDef = {};
  6357. configDef.get = function () { return config; };
  6358. if (true) {
  6359. configDef.set = function () {
  6360. warn(
  6361. 'Do not replace the Vue.config object, set individual fields instead.'
  6362. );
  6363. };
  6364. }
  6365. Object.defineProperty(Vue, 'config', configDef);
  6366. // exposed util methods.
  6367. // NOTE: these are not considered part of the public API - avoid relying on
  6368. // them unless you are aware of the risk.
  6369. Vue.util = {
  6370. warn: warn,
  6371. extend: extend,
  6372. mergeOptions: mergeOptions,
  6373. defineReactive: defineReactive$$1
  6374. };
  6375. Vue.set = set;
  6376. Vue.delete = del;
  6377. Vue.nextTick = nextTick;
  6378. // 2.6 explicit observable API
  6379. Vue.observable = function (obj) {
  6380. observe(obj);
  6381. return obj
  6382. };
  6383. Vue.options = Object.create(null);
  6384. ASSET_TYPES.forEach(function (type) {
  6385. Vue.options[type + 's'] = Object.create(null);
  6386. });
  6387. // this is used to identify the "base" constructor to extend all plain-object
  6388. // components with in Weex's multi-instance scenarios.
  6389. Vue.options._base = Vue;
  6390. extend(Vue.options.components, builtInComponents);
  6391. initUse(Vue);
  6392. initMixin$1(Vue);
  6393. initExtend(Vue);
  6394. initAssetRegisters(Vue);
  6395. }
  6396. initGlobalAPI(Vue);
  6397. Object.defineProperty(Vue.prototype, '$isServer', {
  6398. get: isServerRendering
  6399. });
  6400. Object.defineProperty(Vue.prototype, '$ssrContext', {
  6401. get: function get () {
  6402. /* istanbul ignore next */
  6403. return this.$vnode && this.$vnode.ssrContext
  6404. }
  6405. });
  6406. // expose FunctionalRenderContext for ssr runtime helper installation
  6407. Object.defineProperty(Vue, 'FunctionalRenderContext', {
  6408. value: FunctionalRenderContext
  6409. });
  6410. Vue.version = '2.6.11';
  6411. /**
  6412. * https://raw.githubusercontent.com/Tencent/westore/master/packages/westore/utils/diff.js
  6413. */
  6414. var ARRAYTYPE = '[object Array]';
  6415. var OBJECTTYPE = '[object Object]';
  6416. // const FUNCTIONTYPE = '[object Function]'
  6417. function diff(current, pre) {
  6418. var result = {};
  6419. syncKeys(current, pre);
  6420. _diff(current, pre, '', result);
  6421. return result
  6422. }
  6423. function syncKeys(current, pre) {
  6424. if (current === pre) { return }
  6425. var rootCurrentType = type(current);
  6426. var rootPreType = type(pre);
  6427. if (rootCurrentType == OBJECTTYPE && rootPreType == OBJECTTYPE) {
  6428. if(Object.keys(current).length >= Object.keys(pre).length){
  6429. for (var key in pre) {
  6430. var currentValue = current[key];
  6431. if (currentValue === undefined) {
  6432. current[key] = null;
  6433. } else {
  6434. syncKeys(currentValue, pre[key]);
  6435. }
  6436. }
  6437. }
  6438. } else if (rootCurrentType == ARRAYTYPE && rootPreType == ARRAYTYPE) {
  6439. if (current.length >= pre.length) {
  6440. pre.forEach(function (item, index) {
  6441. syncKeys(current[index], item);
  6442. });
  6443. }
  6444. }
  6445. }
  6446. function _diff(current, pre, path, result) {
  6447. if (current === pre) { return }
  6448. var rootCurrentType = type(current);
  6449. var rootPreType = type(pre);
  6450. if (rootCurrentType == OBJECTTYPE) {
  6451. if (rootPreType != OBJECTTYPE || Object.keys(current).length < Object.keys(pre).length) {
  6452. setResult(result, path, current);
  6453. } else {
  6454. var loop = function ( key ) {
  6455. var currentValue = current[key];
  6456. var preValue = pre[key];
  6457. var currentType = type(currentValue);
  6458. var preType = type(preValue);
  6459. if (currentType != ARRAYTYPE && currentType != OBJECTTYPE) {
  6460. if (currentValue != pre[key]) {
  6461. setResult(result, (path == '' ? '' : path + ".") + key, currentValue);
  6462. }
  6463. } else if (currentType == ARRAYTYPE) {
  6464. if (preType != ARRAYTYPE) {
  6465. setResult(result, (path == '' ? '' : path + ".") + key, currentValue);
  6466. } else {
  6467. if (currentValue.length < preValue.length) {
  6468. setResult(result, (path == '' ? '' : path + ".") + key, currentValue);
  6469. } else {
  6470. currentValue.forEach(function (item, index) {
  6471. _diff(item, preValue[index], (path == '' ? '' : path + ".") + key + '[' + index + ']', result);
  6472. });
  6473. }
  6474. }
  6475. } else if (currentType == OBJECTTYPE) {
  6476. if (preType != OBJECTTYPE || Object.keys(currentValue).length < Object.keys(preValue).length) {
  6477. setResult(result, (path == '' ? '' : path + ".") + key, currentValue);
  6478. } else {
  6479. for (var subKey in currentValue) {
  6480. _diff(currentValue[subKey], preValue[subKey], (path == '' ? '' : path + ".") + key + '.' + subKey, result);
  6481. }
  6482. }
  6483. }
  6484. };
  6485. for (var key in current) loop( key );
  6486. }
  6487. } else if (rootCurrentType == ARRAYTYPE) {
  6488. if (rootPreType != ARRAYTYPE) {
  6489. setResult(result, path, current);
  6490. } else {
  6491. if (current.length < pre.length) {
  6492. setResult(result, path, current);
  6493. } else {
  6494. current.forEach(function (item, index) {
  6495. _diff(item, pre[index], path + '[' + index + ']', result);
  6496. });
  6497. }
  6498. }
  6499. } else {
  6500. setResult(result, path, current);
  6501. }
  6502. }
  6503. function setResult(result, k, v) {
  6504. // if (type(v) != FUNCTIONTYPE) {
  6505. result[k] = v;
  6506. // }
  6507. }
  6508. function type(obj) {
  6509. return Object.prototype.toString.call(obj)
  6510. }
  6511. /* */
  6512. function flushCallbacks$1(vm) {
  6513. if (vm.__next_tick_callbacks && vm.__next_tick_callbacks.length) {
  6514. if (Object({"VUE_APP_NAME":"BLEApp","VUE_APP_PLATFORM":"mp-weixin","NODE_ENV":"development","BASE_URL":"/"}).VUE_APP_DEBUG) {
  6515. var mpInstance = vm.$scope;
  6516. console.log('[' + (+new Date) + '][' + (mpInstance.is || mpInstance.route) + '][' + vm._uid +
  6517. ']:flushCallbacks[' + vm.__next_tick_callbacks.length + ']');
  6518. }
  6519. var copies = vm.__next_tick_callbacks.slice(0);
  6520. vm.__next_tick_callbacks.length = 0;
  6521. for (var i = 0; i < copies.length; i++) {
  6522. copies[i]();
  6523. }
  6524. }
  6525. }
  6526. function hasRenderWatcher(vm) {
  6527. return queue.find(function (watcher) { return vm._watcher === watcher; })
  6528. }
  6529. function nextTick$1(vm, cb) {
  6530. //1.nextTick 之前 已 setData 且 setData 还未回调完成
  6531. //2.nextTick 之前存在 render watcher
  6532. if (!vm.__next_tick_pending && !hasRenderWatcher(vm)) {
  6533. if(Object({"VUE_APP_NAME":"BLEApp","VUE_APP_PLATFORM":"mp-weixin","NODE_ENV":"development","BASE_URL":"/"}).VUE_APP_DEBUG){
  6534. var mpInstance = vm.$scope;
  6535. console.log('[' + (+new Date) + '][' + (mpInstance.is || mpInstance.route) + '][' + vm._uid +
  6536. ']:nextVueTick');
  6537. }
  6538. return nextTick(cb, vm)
  6539. }else{
  6540. if(Object({"VUE_APP_NAME":"BLEApp","VUE_APP_PLATFORM":"mp-weixin","NODE_ENV":"development","BASE_URL":"/"}).VUE_APP_DEBUG){
  6541. var mpInstance$1 = vm.$scope;
  6542. console.log('[' + (+new Date) + '][' + (mpInstance$1.is || mpInstance$1.route) + '][' + vm._uid +
  6543. ']:nextMPTick');
  6544. }
  6545. }
  6546. var _resolve;
  6547. if (!vm.__next_tick_callbacks) {
  6548. vm.__next_tick_callbacks = [];
  6549. }
  6550. vm.__next_tick_callbacks.push(function () {
  6551. if (cb) {
  6552. try {
  6553. cb.call(vm);
  6554. } catch (e) {
  6555. handleError(e, vm, 'nextTick');
  6556. }
  6557. } else if (_resolve) {
  6558. _resolve(vm);
  6559. }
  6560. });
  6561. // $flow-disable-line
  6562. if (!cb && typeof Promise !== 'undefined') {
  6563. return new Promise(function (resolve) {
  6564. _resolve = resolve;
  6565. })
  6566. }
  6567. }
  6568. /* */
  6569. function cloneWithData(vm) {
  6570. // 确保当前 vm 所有数据被同步
  6571. var ret = Object.create(null);
  6572. var dataKeys = [].concat(
  6573. Object.keys(vm._data || {}),
  6574. Object.keys(vm._computedWatchers || {}));
  6575. dataKeys.reduce(function(ret, key) {
  6576. ret[key] = vm[key];
  6577. return ret
  6578. }, ret);
  6579. // vue-composition-api
  6580. var compositionApiState = vm.__composition_api_state__ || vm.__secret_vfa_state__;
  6581. var rawBindings = compositionApiState && compositionApiState.rawBindings;
  6582. if (rawBindings) {
  6583. Object.keys(rawBindings).forEach(function (key) {
  6584. ret[key] = vm[key];
  6585. });
  6586. }
  6587. //TODO 需要把无用数据处理掉,比如 list=>l0 则 list 需要移除,否则多传输一份数据
  6588. Object.assign(ret, vm.$mp.data || {});
  6589. if (
  6590. Array.isArray(vm.$options.behaviors) &&
  6591. vm.$options.behaviors.indexOf('uni://form-field') !== -1
  6592. ) { //form-field
  6593. ret['name'] = vm.name;
  6594. ret['value'] = vm.value;
  6595. }
  6596. return JSON.parse(JSON.stringify(ret))
  6597. }
  6598. var patch = function(oldVnode, vnode) {
  6599. var this$1 = this;
  6600. if (vnode === null) { //destroy
  6601. return
  6602. }
  6603. if (this.mpType === 'page' || this.mpType === 'component') {
  6604. var mpInstance = this.$scope;
  6605. var data = Object.create(null);
  6606. try {
  6607. data = cloneWithData(this);
  6608. } catch (err) {
  6609. console.error(err);
  6610. }
  6611. data.__webviewId__ = mpInstance.data.__webviewId__;
  6612. var mpData = Object.create(null);
  6613. Object.keys(data).forEach(function (key) { //仅同步 data 中有的数据
  6614. mpData[key] = mpInstance.data[key];
  6615. });
  6616. var diffData = this.$shouldDiffData === false ? data : diff(data, mpData);
  6617. if (Object.keys(diffData).length) {
  6618. if (Object({"VUE_APP_NAME":"BLEApp","VUE_APP_PLATFORM":"mp-weixin","NODE_ENV":"development","BASE_URL":"/"}).VUE_APP_DEBUG) {
  6619. console.log('[' + (+new Date) + '][' + (mpInstance.is || mpInstance.route) + '][' + this._uid +
  6620. ']差量更新',
  6621. JSON.stringify(diffData));
  6622. }
  6623. this.__next_tick_pending = true;
  6624. mpInstance.setData(diffData, function () {
  6625. this$1.__next_tick_pending = false;
  6626. flushCallbacks$1(this$1);
  6627. });
  6628. } else {
  6629. flushCallbacks$1(this);
  6630. }
  6631. }
  6632. };
  6633. /* */
  6634. function createEmptyRender() {
  6635. }
  6636. function mountComponent$1(
  6637. vm,
  6638. el,
  6639. hydrating
  6640. ) {
  6641. if (!vm.mpType) {//main.js 中的 new Vue
  6642. return vm
  6643. }
  6644. if (vm.mpType === 'app') {
  6645. vm.$options.render = createEmptyRender;
  6646. }
  6647. if (!vm.$options.render) {
  6648. vm.$options.render = createEmptyRender;
  6649. if (true) {
  6650. /* istanbul ignore if */
  6651. if ((vm.$options.template && vm.$options.template.charAt(0) !== '#') ||
  6652. vm.$options.el || el) {
  6653. warn(
  6654. 'You are using the runtime-only build of Vue where the template ' +
  6655. 'compiler is not available. Either pre-compile the templates into ' +
  6656. 'render functions, or use the compiler-included build.',
  6657. vm
  6658. );
  6659. } else {
  6660. warn(
  6661. 'Failed to mount component: template or render function not defined.',
  6662. vm
  6663. );
  6664. }
  6665. }
  6666. }
  6667. !vm._$fallback && callHook(vm, 'beforeMount');
  6668. var updateComponent = function () {
  6669. vm._update(vm._render(), hydrating);
  6670. };
  6671. // we set this to vm._watcher inside the watcher's constructor
  6672. // since the watcher's initial patch may call $forceUpdate (e.g. inside child
  6673. // component's mounted hook), which relies on vm._watcher being already defined
  6674. new Watcher(vm, updateComponent, noop, {
  6675. before: function before() {
  6676. if (vm._isMounted && !vm._isDestroyed) {
  6677. callHook(vm, 'beforeUpdate');
  6678. }
  6679. }
  6680. }, true /* isRenderWatcher */);
  6681. hydrating = false;
  6682. return vm
  6683. }
  6684. /* */
  6685. function renderClass (
  6686. staticClass,
  6687. dynamicClass
  6688. ) {
  6689. if (isDef(staticClass) || isDef(dynamicClass)) {
  6690. return concat(staticClass, stringifyClass(dynamicClass))
  6691. }
  6692. /* istanbul ignore next */
  6693. return ''
  6694. }
  6695. function concat (a, b) {
  6696. return a ? b ? (a + ' ' + b) : a : (b || '')
  6697. }
  6698. function stringifyClass (value) {
  6699. if (Array.isArray(value)) {
  6700. return stringifyArray(value)
  6701. }
  6702. if (isObject(value)) {
  6703. return stringifyObject(value)
  6704. }
  6705. if (typeof value === 'string') {
  6706. return value
  6707. }
  6708. /* istanbul ignore next */
  6709. return ''
  6710. }
  6711. function stringifyArray (value) {
  6712. var res = '';
  6713. var stringified;
  6714. for (var i = 0, l = value.length; i < l; i++) {
  6715. if (isDef(stringified = stringifyClass(value[i])) && stringified !== '') {
  6716. if (res) { res += ' '; }
  6717. res += stringified;
  6718. }
  6719. }
  6720. return res
  6721. }
  6722. function stringifyObject (value) {
  6723. var res = '';
  6724. for (var key in value) {
  6725. if (value[key]) {
  6726. if (res) { res += ' '; }
  6727. res += key;
  6728. }
  6729. }
  6730. return res
  6731. }
  6732. /* */
  6733. var parseStyleText = cached(function (cssText) {
  6734. var res = {};
  6735. var listDelimiter = /;(?![^(]*\))/g;
  6736. var propertyDelimiter = /:(.+)/;
  6737. cssText.split(listDelimiter).forEach(function (item) {
  6738. if (item) {
  6739. var tmp = item.split(propertyDelimiter);
  6740. tmp.length > 1 && (res[tmp[0].trim()] = tmp[1].trim());
  6741. }
  6742. });
  6743. return res
  6744. });
  6745. // normalize possible array / string values into Object
  6746. function normalizeStyleBinding (bindingStyle) {
  6747. if (Array.isArray(bindingStyle)) {
  6748. return toObject(bindingStyle)
  6749. }
  6750. if (typeof bindingStyle === 'string') {
  6751. return parseStyleText(bindingStyle)
  6752. }
  6753. return bindingStyle
  6754. }
  6755. /* */
  6756. var MP_METHODS = ['createSelectorQuery', 'createIntersectionObserver', 'selectAllComponents', 'selectComponent'];
  6757. function getTarget(obj, path) {
  6758. var parts = path.split('.');
  6759. var key = parts[0];
  6760. if (key.indexOf('__$n') === 0) { //number index
  6761. key = parseInt(key.replace('__$n', ''));
  6762. }
  6763. if (parts.length === 1) {
  6764. return obj[key]
  6765. }
  6766. return getTarget(obj[key], parts.slice(1).join('.'))
  6767. }
  6768. function internalMixin(Vue) {
  6769. Vue.config.errorHandler = function(err, vm, info) {
  6770. Vue.util.warn(("Error in " + info + ": \"" + (err.toString()) + "\""), vm);
  6771. console.error(err);
  6772. /* eslint-disable no-undef */
  6773. var app = getApp();
  6774. if (app && app.onError) {
  6775. app.onError(err);
  6776. }
  6777. };
  6778. var oldEmit = Vue.prototype.$emit;
  6779. Vue.prototype.$emit = function(event) {
  6780. if (this.$scope && event) {
  6781. this.$scope['triggerEvent'](event, {
  6782. __args__: toArray(arguments, 1)
  6783. });
  6784. }
  6785. return oldEmit.apply(this, arguments)
  6786. };
  6787. Vue.prototype.$nextTick = function(fn) {
  6788. return nextTick$1(this, fn)
  6789. };
  6790. MP_METHODS.forEach(function (method) {
  6791. Vue.prototype[method] = function(args) {
  6792. if (this.$scope && this.$scope[method]) {
  6793. return this.$scope[method](args)
  6794. }
  6795. // mp-alipay
  6796. if (typeof my === 'undefined') {
  6797. return
  6798. }
  6799. if (method === 'createSelectorQuery') {
  6800. /* eslint-disable no-undef */
  6801. return my.createSelectorQuery(args)
  6802. } else if (method === 'createIntersectionObserver') {
  6803. /* eslint-disable no-undef */
  6804. return my.createIntersectionObserver(args)
  6805. }
  6806. // TODO mp-alipay 暂不支持 selectAllComponents,selectComponent
  6807. };
  6808. });
  6809. Vue.prototype.__init_provide = initProvide;
  6810. Vue.prototype.__init_injections = initInjections;
  6811. Vue.prototype.__call_hook = function(hook, args) {
  6812. var vm = this;
  6813. // #7573 disable dep collection when invoking lifecycle hooks
  6814. pushTarget();
  6815. var handlers = vm.$options[hook];
  6816. var info = hook + " hook";
  6817. var ret;
  6818. if (handlers) {
  6819. for (var i = 0, j = handlers.length; i < j; i++) {
  6820. ret = invokeWithErrorHandling(handlers[i], vm, args ? [args] : null, vm, info);
  6821. }
  6822. }
  6823. if (vm._hasHookEvent) {
  6824. vm.$emit('hook:' + hook, args);
  6825. }
  6826. popTarget();
  6827. return ret
  6828. };
  6829. Vue.prototype.__set_model = function(target, key, value, modifiers) {
  6830. if (Array.isArray(modifiers)) {
  6831. if (modifiers.indexOf('trim') !== -1) {
  6832. value = value.trim();
  6833. }
  6834. if (modifiers.indexOf('number') !== -1) {
  6835. value = this._n(value);
  6836. }
  6837. }
  6838. if (!target) {
  6839. target = this;
  6840. }
  6841. target[key] = value;
  6842. };
  6843. Vue.prototype.__set_sync = function(target, key, value) {
  6844. if (!target) {
  6845. target = this;
  6846. }
  6847. target[key] = value;
  6848. };
  6849. Vue.prototype.__get_orig = function(item) {
  6850. if (isPlainObject(item)) {
  6851. return item['$orig'] || item
  6852. }
  6853. return item
  6854. };
  6855. Vue.prototype.__get_value = function(dataPath, target) {
  6856. return getTarget(target || this, dataPath)
  6857. };
  6858. Vue.prototype.__get_class = function(dynamicClass, staticClass) {
  6859. return renderClass(staticClass, dynamicClass)
  6860. };
  6861. Vue.prototype.__get_style = function(dynamicStyle, staticStyle) {
  6862. if (!dynamicStyle && !staticStyle) {
  6863. return ''
  6864. }
  6865. var dynamicStyleObj = normalizeStyleBinding(dynamicStyle);
  6866. var styleObj = staticStyle ? extend(staticStyle, dynamicStyleObj) : dynamicStyleObj;
  6867. return Object.keys(styleObj).map(function (name) { return ((hyphenate(name)) + ":" + (styleObj[name])); }).join(';')
  6868. };
  6869. Vue.prototype.__map = function(val, iteratee) {
  6870. //TODO 暂不考虑 string
  6871. var ret, i, l, keys, key;
  6872. if (Array.isArray(val)) {
  6873. ret = new Array(val.length);
  6874. for (i = 0, l = val.length; i < l; i++) {
  6875. ret[i] = iteratee(val[i], i);
  6876. }
  6877. return ret
  6878. } else if (isObject(val)) {
  6879. keys = Object.keys(val);
  6880. ret = Object.create(null);
  6881. for (i = 0, l = keys.length; i < l; i++) {
  6882. key = keys[i];
  6883. ret[key] = iteratee(val[key], key, i);
  6884. }
  6885. return ret
  6886. } else if (typeof val === 'number') {
  6887. ret = new Array(val);
  6888. for (i = 0, l = val; i < l; i++) {
  6889. // 第一个参数暂时仍和小程序一致
  6890. ret[i] = iteratee(i, i);
  6891. }
  6892. return ret
  6893. }
  6894. return []
  6895. };
  6896. }
  6897. /* */
  6898. var LIFECYCLE_HOOKS$1 = [
  6899. //App
  6900. 'onLaunch',
  6901. 'onShow',
  6902. 'onHide',
  6903. 'onUniNViewMessage',
  6904. 'onPageNotFound',
  6905. 'onThemeChange',
  6906. 'onError',
  6907. 'onUnhandledRejection',
  6908. //Page
  6909. 'onInit',
  6910. 'onLoad',
  6911. // 'onShow',
  6912. 'onReady',
  6913. // 'onHide',
  6914. 'onUnload',
  6915. 'onPullDownRefresh',
  6916. 'onReachBottom',
  6917. 'onTabItemTap',
  6918. 'onAddToFavorites',
  6919. 'onShareTimeline',
  6920. 'onShareAppMessage',
  6921. 'onResize',
  6922. 'onPageScroll',
  6923. 'onNavigationBarButtonTap',
  6924. 'onBackPress',
  6925. 'onNavigationBarSearchInputChanged',
  6926. 'onNavigationBarSearchInputConfirmed',
  6927. 'onNavigationBarSearchInputClicked',
  6928. //Component
  6929. // 'onReady', // 兼容旧版本,应该移除该事件
  6930. 'onPageShow',
  6931. 'onPageHide',
  6932. 'onPageResize'
  6933. ];
  6934. function lifecycleMixin$1(Vue) {
  6935. //fixed vue-class-component
  6936. var oldExtend = Vue.extend;
  6937. Vue.extend = function(extendOptions) {
  6938. extendOptions = extendOptions || {};
  6939. var methods = extendOptions.methods;
  6940. if (methods) {
  6941. Object.keys(methods).forEach(function (methodName) {
  6942. if (LIFECYCLE_HOOKS$1.indexOf(methodName)!==-1) {
  6943. extendOptions[methodName] = methods[methodName];
  6944. delete methods[methodName];
  6945. }
  6946. });
  6947. }
  6948. return oldExtend.call(this, extendOptions)
  6949. };
  6950. var strategies = Vue.config.optionMergeStrategies;
  6951. var mergeHook = strategies.created;
  6952. LIFECYCLE_HOOKS$1.forEach(function (hook) {
  6953. strategies[hook] = mergeHook;
  6954. });
  6955. Vue.prototype.__lifecycle_hooks__ = LIFECYCLE_HOOKS$1;
  6956. }
  6957. /* */
  6958. // install platform patch function
  6959. Vue.prototype.__patch__ = patch;
  6960. // public mount method
  6961. Vue.prototype.$mount = function(
  6962. el ,
  6963. hydrating
  6964. ) {
  6965. return mountComponent$1(this, el, hydrating)
  6966. };
  6967. lifecycleMixin$1(Vue);
  6968. internalMixin(Vue);
  6969. /* */
  6970. /* harmony default export */ __webpack_exports__["default"] = (Vue);
  6971. /* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./../../../../../webpack/buildin/global.js */ 3)))
  6972. /***/ }),
  6973. /* 3 */
  6974. /*!***********************************!*\
  6975. !*** (webpack)/buildin/global.js ***!
  6976. \***********************************/
  6977. /*! no static exports found */
  6978. /***/ (function(module, exports) {
  6979. var g;
  6980. // This works in non-strict mode
  6981. g = (function() {
  6982. return this;
  6983. })();
  6984. try {
  6985. // This works if eval is allowed (see CSP)
  6986. g = g || new Function("return this")();
  6987. } catch (e) {
  6988. // This works if the window reference is available
  6989. if (typeof window === "object") g = window;
  6990. }
  6991. // g can still be undefined, but nothing to do about it...
  6992. // We return undefined, instead of nothing here, so it's
  6993. // easier to handle this case. if(!global) { ...}
  6994. module.exports = g;
  6995. /***/ }),
  6996. /* 4 */
  6997. /*!**************************************************!*\
  6998. !*** D:/yin/workspace/uni-app/BLEApp/pages.json ***!
  6999. \**************************************************/
  7000. /*! no static exports found */
  7001. /***/ (function(module, exports) {
  7002. /***/ }),
  7003. /* 5 */,
  7004. /* 6 */,
  7005. /* 7 */,
  7006. /* 8 */,
  7007. /* 9 */,
  7008. /* 10 */
  7009. /*!**********************************************************************************************************!*\
  7010. !*** ./node_modules/@dcloudio/vue-cli-plugin-uni/packages/vue-loader/lib/runtime/componentNormalizer.js ***!
  7011. \**********************************************************************************************************/
  7012. /*! exports provided: default */
  7013. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  7014. "use strict";
  7015. __webpack_require__.r(__webpack_exports__);
  7016. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "default", function() { return normalizeComponent; });
  7017. /* globals __VUE_SSR_CONTEXT__ */
  7018. // IMPORTANT: Do NOT use ES2015 features in this file (except for modules).
  7019. // This module is a runtime utility for cleaner component module output and will
  7020. // be included in the final webpack user bundle.
  7021. function normalizeComponent (
  7022. scriptExports,
  7023. render,
  7024. staticRenderFns,
  7025. functionalTemplate,
  7026. injectStyles,
  7027. scopeId,
  7028. moduleIdentifier, /* server only */
  7029. shadowMode, /* vue-cli only */
  7030. components, // fixed by xxxxxx auto components
  7031. renderjs // fixed by xxxxxx renderjs
  7032. ) {
  7033. // Vue.extend constructor export interop
  7034. var options = typeof scriptExports === 'function'
  7035. ? scriptExports.options
  7036. : scriptExports
  7037. // fixed by xxxxxx auto components
  7038. if (components) {
  7039. if (!options.components) {
  7040. options.components = {}
  7041. }
  7042. var hasOwn = Object.prototype.hasOwnProperty
  7043. for (var name in components) {
  7044. if (hasOwn.call(components, name) && !hasOwn.call(options.components, name)) {
  7045. options.components[name] = components[name]
  7046. }
  7047. }
  7048. }
  7049. // fixed by xxxxxx renderjs
  7050. if (renderjs) {
  7051. (renderjs.beforeCreate || (renderjs.beforeCreate = [])).unshift(function() {
  7052. this[renderjs.__module] = this
  7053. });
  7054. (options.mixins || (options.mixins = [])).push(renderjs)
  7055. }
  7056. // render functions
  7057. if (render) {
  7058. options.render = render
  7059. options.staticRenderFns = staticRenderFns
  7060. options._compiled = true
  7061. }
  7062. // functional template
  7063. if (functionalTemplate) {
  7064. options.functional = true
  7065. }
  7066. // scopedId
  7067. if (scopeId) {
  7068. options._scopeId = 'data-v-' + scopeId
  7069. }
  7070. var hook
  7071. if (moduleIdentifier) { // server build
  7072. hook = function (context) {
  7073. // 2.3 injection
  7074. context =
  7075. context || // cached call
  7076. (this.$vnode && this.$vnode.ssrContext) || // stateful
  7077. (this.parent && this.parent.$vnode && this.parent.$vnode.ssrContext) // functional
  7078. // 2.2 with runInNewContext: true
  7079. if (!context && typeof __VUE_SSR_CONTEXT__ !== 'undefined') {
  7080. context = __VUE_SSR_CONTEXT__
  7081. }
  7082. // inject component styles
  7083. if (injectStyles) {
  7084. injectStyles.call(this, context)
  7085. }
  7086. // register component module identifier for async chunk inferrence
  7087. if (context && context._registeredComponents) {
  7088. context._registeredComponents.add(moduleIdentifier)
  7089. }
  7090. }
  7091. // used by ssr in case component is cached and beforeCreate
  7092. // never gets called
  7093. options._ssrRegister = hook
  7094. } else if (injectStyles) {
  7095. hook = shadowMode
  7096. ? function () { injectStyles.call(this, this.$root.$options.shadowRoot) }
  7097. : injectStyles
  7098. }
  7099. if (hook) {
  7100. if (options.functional) {
  7101. // for template-only hot-reload because in that case the render fn doesn't
  7102. // go through the normalizer
  7103. options._injectStyles = hook
  7104. // register for functioal component in vue file
  7105. var originalRender = options.render
  7106. options.render = function renderWithStyleInjection (h, context) {
  7107. hook.call(context)
  7108. return originalRender(h, context)
  7109. }
  7110. } else {
  7111. // inject component registration as beforeCreate hook
  7112. var existing = options.beforeCreate
  7113. options.beforeCreate = existing
  7114. ? [].concat(existing, hook)
  7115. : [hook]
  7116. }
  7117. }
  7118. return {
  7119. exports: scriptExports,
  7120. options: options
  7121. }
  7122. }
  7123. /***/ }),
  7124. /* 11 */
  7125. /*!**********************************************************************!*\
  7126. !*** D:/yin/workspace/uni-app/BLEApp/node_modules/uview-ui/index.js ***!
  7127. \**********************************************************************/
  7128. /*! no static exports found */
  7129. /***/ (function(module, exports, __webpack_require__) {
  7130. "use strict";
  7131. /* WEBPACK VAR INJECTION */(function(uni) {Object.defineProperty(exports, "__esModule", { value: true });exports.default = void 0;
  7132. var _mixin = _interopRequireDefault(__webpack_require__(/*! ./libs/mixin/mixin.js */ 12));
  7133. var _request = _interopRequireDefault(__webpack_require__(/*! ./libs/request */ 13));
  7134. var _queryParams = _interopRequireDefault(__webpack_require__(/*! ./libs/function/queryParams.js */ 17));
  7135. var _route = _interopRequireDefault(__webpack_require__(/*! ./libs/function/route.js */ 18));
  7136. var _timeFormat = _interopRequireDefault(__webpack_require__(/*! ./libs/function/timeFormat.js */ 22));
  7137. var _timeFrom = _interopRequireDefault(__webpack_require__(/*! ./libs/function/timeFrom.js */ 23));
  7138. var _colorGradient = _interopRequireDefault(__webpack_require__(/*! ./libs/function/colorGradient.js */ 24));
  7139. var _guid = _interopRequireDefault(__webpack_require__(/*! ./libs/function/guid.js */ 25));
  7140. var _color = _interopRequireDefault(__webpack_require__(/*! ./libs/function/color.js */ 26));
  7141. var _type2icon = _interopRequireDefault(__webpack_require__(/*! ./libs/function/type2icon.js */ 27));
  7142. var _randomArray = _interopRequireDefault(__webpack_require__(/*! ./libs/function/randomArray.js */ 28));
  7143. var _deepClone = _interopRequireDefault(__webpack_require__(/*! ./libs/function/deepClone.js */ 15));
  7144. var _deepMerge = _interopRequireDefault(__webpack_require__(/*! ./libs/function/deepMerge.js */ 14));
  7145. var _addUnit = _interopRequireDefault(__webpack_require__(/*! ./libs/function/addUnit.js */ 29));
  7146. var _test = _interopRequireDefault(__webpack_require__(/*! ./libs/function/test.js */ 16));
  7147. var _random = _interopRequireDefault(__webpack_require__(/*! ./libs/function/random.js */ 30));
  7148. var _trim = _interopRequireDefault(__webpack_require__(/*! ./libs/function/trim.js */ 31));
  7149. var _toast = _interopRequireDefault(__webpack_require__(/*! ./libs/function/toast.js */ 32));
  7150. var _getParent = _interopRequireDefault(__webpack_require__(/*! ./libs/function/getParent.js */ 33));
  7151. var _$parent = _interopRequireDefault(__webpack_require__(/*! ./libs/function/$parent.js */ 34));
  7152. var _sys = __webpack_require__(/*! ./libs/function/sys.js */ 35);
  7153. var _debounce = _interopRequireDefault(__webpack_require__(/*! ./libs/function/debounce.js */ 36));
  7154. var _throttle = _interopRequireDefault(__webpack_require__(/*! ./libs/function/throttle.js */ 37));
  7155. var _config = _interopRequireDefault(__webpack_require__(/*! ./libs/config/config.js */ 38));
  7156. var _zIndex = _interopRequireDefault(__webpack_require__(/*! ./libs/config/zIndex.js */ 39));function _interopRequireDefault(obj) {return obj && obj.__esModule ? obj : { default: obj };} // 引入全局mixin
  7157. // 引入关于是否mixin集成小程序分享的配置
  7158. // import wxshare from './libs/mixin/mpShare.js'
  7159. // 全局挂载引入http相关请求拦截插件
  7160. function wranning(str) {// 开发环境进行信息输出,主要是一些报错信息
  7161. // 这个环境的来由是在程序编写时候,点击hx编辑器运行调试代码的时候,详见:
  7162. // https://uniapp.dcloud.io/frame?id=%e5%bc%80%e5%8f%91%e7%8e%af%e5%a2%83%e5%92%8c%e7%94%9f%e4%ba%a7%e7%8e%af%e5%a2%83
  7163. if (true) {console.warn(str);}} // 尝试判断在根目录的/store中是否有$u.mixin.js,此文件uView默认为需要挂在到全局的vuex的state变量
  7164. // HX2.6.11版本,放到try中,控制台依然会警告,暂时不用此方式,
  7165. // let vuexStore = {};
  7166. // try {
  7167. // vuexStore = require("@/store/$u.mixin.js");
  7168. // } catch (e) {
  7169. // //TODO handle the exception
  7170. // }
  7171. // post类型对象参数转为get类型url参数
  7172. var $u = { queryParams: _queryParams.default, route: _route.default, timeFormat: _timeFormat.default, date: _timeFormat.default, // 另名date
  7173. timeFrom: _timeFrom.default, colorGradient: _colorGradient.default.colorGradient, colorToRgba: _colorGradient.default.colorToRgba, guid: _guid.default, color: _color.default, sys: _sys.sys, os: _sys.os, type2icon: _type2icon.default, randomArray: _randomArray.default, wranning: wranning, get: _request.default.get,
  7174. post: _request.default.post,
  7175. put: _request.default.put,
  7176. 'delete': _request.default.delete,
  7177. hexToRgb: _colorGradient.default.hexToRgb,
  7178. rgbToHex: _colorGradient.default.rgbToHex,
  7179. test: _test.default,
  7180. random: _random.default,
  7181. deepClone: _deepClone.default,
  7182. deepMerge: _deepMerge.default,
  7183. getParent: _getParent.default,
  7184. $parent: _$parent.default,
  7185. addUnit: _addUnit.default,
  7186. trim: _trim.default,
  7187. type: ['primary', 'success', 'error', 'warning', 'info'],
  7188. http: _request.default,
  7189. toast: _toast.default,
  7190. config: _config.default, // uView配置信息相关,比如版本号
  7191. zIndex: _zIndex.default,
  7192. debounce: _debounce.default,
  7193. throttle: _throttle.default };
  7194. // $u挂载到uni对象上
  7195. uni.$u = $u;
  7196. var install = function install(Vue) {
  7197. Vue.mixin(_mixin.default);
  7198. if (Vue.prototype.openShare) {
  7199. Vue.mixin(mpShare);
  7200. }
  7201. // Vue.mixin(vuexStore);
  7202. // 时间格式化,同时两个名称,date和timeFormat
  7203. Vue.filter('timeFormat', function (timestamp, format) {
  7204. return (0, _timeFormat.default)(timestamp, format);
  7205. });
  7206. Vue.filter('date', function (timestamp, format) {
  7207. return (0, _timeFormat.default)(timestamp, format);
  7208. });
  7209. // 将多久以前的方法,注入到全局过滤器
  7210. Vue.filter('timeFrom', function (timestamp, format) {
  7211. return (0, _timeFrom.default)(timestamp, format);
  7212. });
  7213. Vue.prototype.$u = $u;
  7214. };var _default =
  7215. {
  7216. install: install };exports.default = _default;
  7217. /* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./node_modules/@dcloudio/uni-mp-weixin/dist/index.js */ 1)["default"]))
  7218. /***/ }),
  7219. /* 12 */
  7220. /*!*********************************************************************************!*\
  7221. !*** D:/yin/workspace/uni-app/BLEApp/node_modules/uview-ui/libs/mixin/mixin.js ***!
  7222. \*********************************************************************************/
  7223. /*! no static exports found */
  7224. /***/ (function(module, exports, __webpack_require__) {
  7225. /* WEBPACK VAR INJECTION */(function(uni) {module.exports = {
  7226. data: function data() {
  7227. return {};
  7228. },
  7229. onLoad: function onLoad() {
  7230. // getRect挂载到$u上,因为这方法需要使用in(this),所以无法把它独立成一个单独的文件导出
  7231. this.$u.getRect = this.$uGetRect;
  7232. },
  7233. methods: {
  7234. // 查询节点信息
  7235. // 目前此方法在支付宝小程序中无法获取组件跟接点的尺寸,为支付宝的bug(2020-07-21)
  7236. // 解决办法为在组件根部再套一个没有任何作用的view元素
  7237. $uGetRect: function $uGetRect(selector, all) {var _this = this;
  7238. return new Promise(function (resolve) {
  7239. uni.createSelectorQuery().
  7240. in(_this)[all ? 'selectAll' : 'select'](selector).
  7241. boundingClientRect(function (rect) {
  7242. if (all && Array.isArray(rect) && rect.length) {
  7243. resolve(rect);
  7244. }
  7245. if (!all && rect) {
  7246. resolve(rect);
  7247. }
  7248. }).
  7249. exec();
  7250. });
  7251. },
  7252. getParentData: function getParentData() {var _this2 = this;var parentName = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : '';
  7253. // 避免在created中去定义parent变量
  7254. if (!this.parent) this.parent = false;
  7255. // 这里的本质原理是,通过获取父组件实例(也即u-radio-group的this)
  7256. // 将父组件this中对应的参数,赋值给本组件(u-radio的this)的parentData对象中对应的属性
  7257. // 之所以需要这么做,是因为所有端中,头条小程序不支持通过this.parent.xxx去监听父组件参数的变化
  7258. this.parent = this.$u.$parent.call(this, parentName);
  7259. if (this.parent) {
  7260. // 历遍parentData中的属性,将parent中的同名属性赋值给parentData
  7261. Object.keys(this.parentData).map(function (key) {
  7262. _this2.parentData[key] = _this2.parent[key];
  7263. });
  7264. }
  7265. },
  7266. // 阻止事件冒泡
  7267. preventEvent: function preventEvent(e) {
  7268. e && e.stopPropagation && e.stopPropagation();
  7269. } },
  7270. onReachBottom: function onReachBottom() {
  7271. uni.$emit('uOnReachBottom');
  7272. },
  7273. beforeDestroy: function beforeDestroy() {var _this3 = this;
  7274. // 判断当前页面是否存在parent和chldren,一般在checkbox和checkbox-group父子联动的场景会有此情况
  7275. // 组件销毁时,移除子组件在父组件children数组中的实例,释放资源,避免数据混乱
  7276. if (this.parent && uni.$u.test.array(this.parent.children)) {
  7277. // 组件销毁时,移除父组件中的children数组中对应的实例
  7278. var childrenList = this.parent.children;
  7279. childrenList.map(function (child, index) {
  7280. // 如果相等,则移除
  7281. if (child === _this3) {
  7282. childrenList.splice(index, 1);
  7283. }
  7284. });
  7285. }
  7286. } };
  7287. /* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./node_modules/@dcloudio/uni-mp-weixin/dist/index.js */ 1)["default"]))
  7288. /***/ }),
  7289. /* 13 */
  7290. /*!***********************************************************************************!*\
  7291. !*** D:/yin/workspace/uni-app/BLEApp/node_modules/uview-ui/libs/request/index.js ***!
  7292. \***********************************************************************************/
  7293. /*! no static exports found */
  7294. /***/ (function(module, exports, __webpack_require__) {
  7295. "use strict";
  7296. /* WEBPACK VAR INJECTION */(function(uni) {Object.defineProperty(exports, "__esModule", { value: true });exports.default = void 0;var _deepMerge = _interopRequireDefault(__webpack_require__(/*! ../function/deepMerge */ 14));
  7297. var _test = _interopRequireDefault(__webpack_require__(/*! ../function/test */ 16));function _interopRequireDefault(obj) {return obj && obj.__esModule ? obj : { default: obj };}function _classCallCheck(instance, Constructor) {if (!(instance instanceof Constructor)) {throw new TypeError("Cannot call a class as a function");}}function _defineProperties(target, props) {for (var i = 0; i < props.length; i++) {var descriptor = props[i];descriptor.enumerable = descriptor.enumerable || false;descriptor.configurable = true;if ("value" in descriptor) descriptor.writable = true;Object.defineProperty(target, descriptor.key, descriptor);}}function _createClass(Constructor, protoProps, staticProps) {if (protoProps) _defineProperties(Constructor.prototype, protoProps);if (staticProps) _defineProperties(Constructor, staticProps);return Constructor;}var
  7298. Request = /*#__PURE__*/function () {_createClass(Request, [{ key: "setConfig",
  7299. // 设置全局默认配置
  7300. value: function setConfig(customConfig) {
  7301. // 深度合并对象,否则会造成对象深层属性丢失
  7302. this.config = (0, _deepMerge.default)(this.config, customConfig);
  7303. }
  7304. // 主要请求部分
  7305. }, { key: "request", value: function request() {var _this = this;var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
  7306. // 检查请求拦截
  7307. if (this.interceptor.request && typeof this.interceptor.request === 'function') {
  7308. var tmpConfig = {};
  7309. var interceptorRequest = this.interceptor.request(options);
  7310. if (interceptorRequest === false) {
  7311. // 返回一个处于pending状态中的Promise,来取消原promise,避免进入then()回调
  7312. return new Promise(function () {});
  7313. }
  7314. this.options = interceptorRequest;
  7315. }
  7316. options.dataType = options.dataType || this.config.dataType;
  7317. options.responseType = options.responseType || this.config.responseType;
  7318. options.url = options.url || '';
  7319. options.params = options.params || {};
  7320. options.header = Object.assign({}, this.config.header, options.header);
  7321. options.method = options.method || this.config.method;
  7322. return new Promise(function (resolve, reject) {
  7323. options.complete = function (response) {
  7324. // 请求返回后,隐藏loading(如果请求返回快的话,可能会没有loading)
  7325. uni.hideLoading();
  7326. // 清除定时器,如果请求回来了,就无需loading
  7327. clearTimeout(_this.config.timer);
  7328. _this.config.timer = null;
  7329. // 判断用户对拦截返回数据的要求,如果originalData为true,返回所有的数据(response)到拦截器,否则只返回response.data
  7330. if (_this.config.originalData) {
  7331. // 判断是否存在拦截器
  7332. if (_this.interceptor.response && typeof _this.interceptor.response === 'function') {
  7333. var resInterceptors = _this.interceptor.response(response);
  7334. // 如果拦截器不返回false,就将拦截器返回的内容给this.$u.post的then回调
  7335. if (resInterceptors !== false) {
  7336. resolve(resInterceptors);
  7337. } else {
  7338. // 如果拦截器返回false,意味着拦截器定义者认为返回有问题,直接接入catch回调
  7339. reject(response);
  7340. }
  7341. } else {
  7342. // 如果要求返回原始数据,就算没有拦截器,也返回最原始的数据
  7343. resolve(response);
  7344. }
  7345. } else {
  7346. if (response.statusCode == 200) {
  7347. if (_this.interceptor.response && typeof _this.interceptor.response === 'function') {
  7348. var _resInterceptors = _this.interceptor.response(response.data);
  7349. if (_resInterceptors !== false) {
  7350. resolve(_resInterceptors);
  7351. } else {
  7352. reject(response.data);
  7353. }
  7354. } else {
  7355. // 如果不是返回原始数据(originalData=false),且没有拦截器的情况下,返回纯数据给then回调
  7356. resolve(response.data);
  7357. }
  7358. } else {
  7359. // 不返回原始数据的情况下,服务器状态码不为200,modal弹框提示
  7360. // if(response.errMsg) {
  7361. // uni.showModal({
  7362. // title: response.errMsg
  7363. // });
  7364. // }
  7365. reject(response);
  7366. }
  7367. }
  7368. };
  7369. // 判断用户传递的URL是否/开头,如果不是,加上/,这里使用了uView的test.js验证库的url()方法
  7370. options.url = _test.default.url(options.url) ? options.url : _this.config.baseUrl + (options.url.indexOf('/') == 0 ?
  7371. options.url : '/' + options.url);
  7372. // 是否显示loading
  7373. // 加一个是否已有timer定时器的判断,否则有两个同时请求的时候,后者会清除前者的定时器id
  7374. // 而没有清除前者的定时器,导致前者超时,一直显示loading
  7375. if (_this.config.showLoading && !_this.config.timer) {
  7376. _this.config.timer = setTimeout(function () {
  7377. uni.showLoading({
  7378. title: _this.config.loadingText,
  7379. mask: _this.config.loadingMask });
  7380. _this.config.timer = null;
  7381. }, _this.config.loadingTime);
  7382. }
  7383. uni.request(options);
  7384. });
  7385. // .catch(res => {
  7386. // // 如果返回reject(),不让其进入this.$u.post().then().catch()后面的catct()
  7387. // // 因为很多人都会忘了写后面的catch(),导致报错捕获不到catch
  7388. // return new Promise(()=>{});
  7389. // })
  7390. } }]);
  7391. function Request() {var _this2 = this;_classCallCheck(this, Request);
  7392. this.config = {
  7393. baseUrl: '', // 请求的根域名
  7394. // 默认的请求头
  7395. header: {},
  7396. method: 'POST',
  7397. // 设置为json,返回后uni.request会对数据进行一次JSON.parse
  7398. dataType: 'json',
  7399. // 此参数无需处理,因为5+和支付宝小程序不支持,默认为text即可
  7400. responseType: 'text',
  7401. showLoading: true, // 是否显示请求中的loading
  7402. loadingText: '请求中...',
  7403. loadingTime: 800, // 在此时间内,请求还没回来的话,就显示加载中动画,单位ms
  7404. timer: null, // 定时器
  7405. originalData: false, // 是否在拦截器中返回服务端的原始数据,见文档说明
  7406. loadingMask: true // 展示loading的时候,是否给一个透明的蒙层,防止触摸穿透
  7407. };
  7408. // 拦截器
  7409. this.interceptor = {
  7410. // 请求前的拦截
  7411. request: null,
  7412. // 请求后的拦截
  7413. response: null };
  7414. // get请求
  7415. this.get = function (url) {var data = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};var header = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
  7416. return _this2.request({
  7417. method: 'GET',
  7418. url: url,
  7419. header: header,
  7420. data: data });
  7421. };
  7422. // post请求
  7423. this.post = function (url) {var data = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};var header = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
  7424. return _this2.request({
  7425. url: url,
  7426. method: 'POST',
  7427. header: header,
  7428. data: data });
  7429. };
  7430. // put请求,不支持支付宝小程序(HX2.6.15)
  7431. this.put = function (url) {var data = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};var header = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
  7432. return _this2.request({
  7433. url: url,
  7434. method: 'PUT',
  7435. header: header,
  7436. data: data });
  7437. };
  7438. // delete请求,不支持支付宝和头条小程序(HX2.6.15)
  7439. this.delete = function (url) {var data = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};var header = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
  7440. return _this2.request({
  7441. url: url,
  7442. method: 'DELETE',
  7443. header: header,
  7444. data: data });
  7445. };
  7446. }return Request;}();var _default =
  7447. new Request();exports.default = _default;
  7448. /* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./node_modules/@dcloudio/uni-mp-weixin/dist/index.js */ 1)["default"]))
  7449. /***/ }),
  7450. /* 14 */
  7451. /*!****************************************************************************************!*\
  7452. !*** D:/yin/workspace/uni-app/BLEApp/node_modules/uview-ui/libs/function/deepMerge.js ***!
  7453. \****************************************************************************************/
  7454. /*! no static exports found */
  7455. /***/ (function(module, exports, __webpack_require__) {
  7456. "use strict";
  7457. Object.defineProperty(exports, "__esModule", { value: true });exports.default = void 0;var _deepClone = _interopRequireDefault(__webpack_require__(/*! ./deepClone */ 15));function _interopRequireDefault(obj) {return obj && obj.__esModule ? obj : { default: obj };}
  7458. // JS对象深度合并
  7459. function deepMerge() {var target = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};var source = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
  7460. target = (0, _deepClone.default)(target);
  7461. if (typeof target !== 'object' || typeof source !== 'object') return false;
  7462. for (var prop in source) {
  7463. if (!source.hasOwnProperty(prop)) continue;
  7464. if (prop in target) {
  7465. if (typeof target[prop] !== 'object') {
  7466. target[prop] = source[prop];
  7467. } else {
  7468. if (typeof source[prop] !== 'object') {
  7469. target[prop] = source[prop];
  7470. } else {
  7471. if (target[prop].concat && source[prop].concat) {
  7472. target[prop] = target[prop].concat(source[prop]);
  7473. } else {
  7474. target[prop] = deepMerge(target[prop], source[prop]);
  7475. }
  7476. }
  7477. }
  7478. } else {
  7479. target[prop] = source[prop];
  7480. }
  7481. }
  7482. return target;
  7483. }var _default =
  7484. deepMerge;exports.default = _default;
  7485. /***/ }),
  7486. /* 15 */
  7487. /*!****************************************************************************************!*\
  7488. !*** D:/yin/workspace/uni-app/BLEApp/node_modules/uview-ui/libs/function/deepClone.js ***!
  7489. \****************************************************************************************/
  7490. /*! no static exports found */
  7491. /***/ (function(module, exports, __webpack_require__) {
  7492. "use strict";
  7493. Object.defineProperty(exports, "__esModule", { value: true });exports.default = void 0; // 判断arr是否为一个数组,返回一个bool值
  7494. function isArray(arr) {
  7495. return Object.prototype.toString.call(arr) === '[object Array]';
  7496. }
  7497. // 深度克隆
  7498. function deepClone(obj) {
  7499. // 对常见的“非”值,直接返回原来值
  7500. if ([null, undefined, NaN, false].includes(obj)) return obj;
  7501. if (typeof obj !== "object" && typeof obj !== 'function') {
  7502. //原始类型直接返回
  7503. return obj;
  7504. }
  7505. var o = isArray(obj) ? [] : {};
  7506. for (var i in obj) {
  7507. if (obj.hasOwnProperty(i)) {
  7508. o[i] = typeof obj[i] === "object" ? deepClone(obj[i]) : obj[i];
  7509. }
  7510. }
  7511. return o;
  7512. }var _default =
  7513. deepClone;exports.default = _default;
  7514. /***/ }),
  7515. /* 16 */
  7516. /*!***********************************************************************************!*\
  7517. !*** D:/yin/workspace/uni-app/BLEApp/node_modules/uview-ui/libs/function/test.js ***!
  7518. \***********************************************************************************/
  7519. /*! no static exports found */
  7520. /***/ (function(module, exports, __webpack_require__) {
  7521. "use strict";
  7522. Object.defineProperty(exports, "__esModule", { value: true });exports.default = void 0; /**
  7523. * 验证电子邮箱格式
  7524. */
  7525. function email(value) {
  7526. return /^\w+((-\w+)|(\.\w+))*\@[A-Za-z0-9]+((\.|-)[A-Za-z0-9]+)*\.[A-Za-z0-9]+$/.test(value);
  7527. }
  7528. /**
  7529. * 验证手机格式
  7530. */
  7531. function mobile(value) {
  7532. return /^1[3-9]\d{9}$/.test(value);
  7533. }
  7534. /**
  7535. * 验证URL格式
  7536. */
  7537. function url(value) {
  7538. return /http(s)?:\/\/([\w-]+\.)+[\w-]+(\/[\w-.\/?%&=]*)?/.test(value);
  7539. }
  7540. /**
  7541. * 验证日期格式
  7542. */
  7543. function date(value) {
  7544. return !/Invalid|NaN/.test(new Date(value).toString());
  7545. }
  7546. /**
  7547. * 验证ISO类型的日期格式
  7548. */
  7549. function dateISO(value) {
  7550. return /^\d{4}[\/\-](0?[1-9]|1[012])[\/\-](0?[1-9]|[12][0-9]|3[01])$/.test(value);
  7551. }
  7552. /**
  7553. * 验证十进制数字
  7554. */
  7555. function number(value) {
  7556. return /^(?:-?\d+|-?\d{1,3}(?:,\d{3})+)?(?:\.\d+)?$/.test(value);
  7557. }
  7558. /**
  7559. * 验证整数
  7560. */
  7561. function digits(value) {
  7562. return /^\d+$/.test(value);
  7563. }
  7564. /**
  7565. * 验证身份证号码
  7566. */
  7567. function idCard(value) {
  7568. return /^[1-9]\d{5}[1-9]\d{3}((0\d)|(1[0-2]))(([0|1|2]\d)|3[0-1])\d{3}([0-9]|X)$/.test(
  7569. value);
  7570. }
  7571. /**
  7572. * 是否车牌号
  7573. */
  7574. function carNo(value) {
  7575. // 新能源车牌
  7576. var xreg = /^[京津沪渝冀豫云辽黑湘皖鲁新苏浙赣鄂桂甘晋蒙陕吉闽贵粤青藏川宁琼使领A-Z]{1}[A-Z]{1}(([0-9]{5}[DF]$)|([DF][A-HJ-NP-Z0-9][0-9]{4}$))/;
  7577. // 旧车牌
  7578. var creg = /^[京津沪渝冀豫云辽黑湘皖鲁新苏浙赣鄂桂甘晋蒙陕吉闽贵粤青藏川宁琼使领A-Z]{1}[A-Z]{1}[A-HJ-NP-Z0-9]{4}[A-HJ-NP-Z0-9挂学警港澳]{1}$/;
  7579. if (value.length === 7) {
  7580. return creg.test(value);
  7581. } else if (value.length === 8) {
  7582. return xreg.test(value);
  7583. } else {
  7584. return false;
  7585. }
  7586. }
  7587. /**
  7588. * 金额,只允许2位小数
  7589. */
  7590. function amount(value) {
  7591. //金额,只允许保留两位小数
  7592. return /^[1-9]\d*(,\d{3})*(\.\d{1,2})?$|^0\.\d{1,2}$/.test(value);
  7593. }
  7594. /**
  7595. * 中文
  7596. */
  7597. function chinese(value) {
  7598. var reg = /^[\u4e00-\u9fa5]+$/gi;
  7599. return reg.test(value);
  7600. }
  7601. /**
  7602. * 只能输入字母
  7603. */
  7604. function letter(value) {
  7605. return /^[a-zA-Z]*$/.test(value);
  7606. }
  7607. /**
  7608. * 只能是字母或者数字
  7609. */
  7610. function enOrNum(value) {
  7611. //英文或者数字
  7612. var reg = /^[0-9a-zA-Z]*$/g;
  7613. return reg.test(value);
  7614. }
  7615. /**
  7616. * 验证是否包含某个值
  7617. */
  7618. function contains(value, param) {
  7619. return value.indexOf(param) >= 0;
  7620. }
  7621. /**
  7622. * 验证一个值范围[min, max]
  7623. */
  7624. function range(value, param) {
  7625. return value >= param[0] && value <= param[1];
  7626. }
  7627. /**
  7628. * 验证一个长度范围[min, max]
  7629. */
  7630. function rangeLength(value, param) {
  7631. return value.length >= param[0] && value.length <= param[1];
  7632. }
  7633. /**
  7634. * 是否固定电话
  7635. */
  7636. function landline(value) {
  7637. var reg = /^\d{3,4}-\d{7,8}(-\d{3,4})?$/;
  7638. return reg.test(value);
  7639. }
  7640. /**
  7641. * 判断是否为空
  7642. */
  7643. function empty(value) {
  7644. switch (typeof value) {
  7645. case 'undefined':
  7646. return true;
  7647. case 'string':
  7648. if (value.replace(/(^[ \t\n\r]*)|([ \t\n\r]*$)/g, '').length == 0) return true;
  7649. break;
  7650. case 'boolean':
  7651. if (!value) return true;
  7652. break;
  7653. case 'number':
  7654. if (0 === value || isNaN(value)) return true;
  7655. break;
  7656. case 'object':
  7657. if (null === value || value.length === 0) return true;
  7658. for (var i in value) {
  7659. return false;
  7660. }
  7661. return true;}
  7662. return false;
  7663. }
  7664. /**
  7665. * 是否json字符串
  7666. */
  7667. function jsonString(value) {
  7668. if (typeof value == 'string') {
  7669. try {
  7670. var obj = JSON.parse(value);
  7671. if (typeof obj == 'object' && obj) {
  7672. return true;
  7673. } else {
  7674. return false;
  7675. }
  7676. } catch (e) {
  7677. return false;
  7678. }
  7679. }
  7680. return false;
  7681. }
  7682. /**
  7683. * 是否数组
  7684. */
  7685. function array(value) {
  7686. if (typeof Array.isArray === "function") {
  7687. return Array.isArray(value);
  7688. } else {
  7689. return Object.prototype.toString.call(value) === "[object Array]";
  7690. }
  7691. }
  7692. /**
  7693. * 是否对象
  7694. */
  7695. function object(value) {
  7696. return Object.prototype.toString.call(value) === '[object Object]';
  7697. }
  7698. /**
  7699. * 是否短信验证码
  7700. */
  7701. function code(value) {var len = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 6;
  7702. return new RegExp("^\\d{".concat(len, "}$")).test(value);
  7703. }var _default =
  7704. {
  7705. email: email,
  7706. mobile: mobile,
  7707. url: url,
  7708. date: date,
  7709. dateISO: dateISO,
  7710. number: number,
  7711. digits: digits,
  7712. idCard: idCard,
  7713. carNo: carNo,
  7714. amount: amount,
  7715. chinese: chinese,
  7716. letter: letter,
  7717. enOrNum: enOrNum,
  7718. contains: contains,
  7719. range: range,
  7720. rangeLength: rangeLength,
  7721. empty: empty,
  7722. isEmpty: empty,
  7723. jsonString: jsonString,
  7724. landline: landline,
  7725. object: object,
  7726. array: array,
  7727. code: code };exports.default = _default;
  7728. /***/ }),
  7729. /* 17 */
  7730. /*!******************************************************************************************!*\
  7731. !*** D:/yin/workspace/uni-app/BLEApp/node_modules/uview-ui/libs/function/queryParams.js ***!
  7732. \******************************************************************************************/
  7733. /*! no static exports found */
  7734. /***/ (function(module, exports, __webpack_require__) {
  7735. "use strict";
  7736. Object.defineProperty(exports, "__esModule", { value: true });exports.default = void 0; /**
  7737. * 对象转url参数
  7738. * @param {*} data,对象
  7739. * @param {*} isPrefix,是否自动加上"?"
  7740. */
  7741. function queryParams() {var data = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};var isPrefix = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;var arrayFormat = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 'brackets';
  7742. var prefix = isPrefix ? '?' : '';
  7743. var _result = [];
  7744. if (['indices', 'brackets', 'repeat', 'comma'].indexOf(arrayFormat) == -1) arrayFormat = 'brackets';var _loop = function _loop(
  7745. key) {
  7746. var value = data[key];
  7747. // 去掉为空的参数
  7748. if (['', undefined, null].indexOf(value) >= 0) {
  7749. return "continue";
  7750. }
  7751. // 如果值为数组,另行处理
  7752. if (value.constructor === Array) {
  7753. // e.g. {ids: [1, 2, 3]}
  7754. switch (arrayFormat) {
  7755. case 'indices':
  7756. // 结果: ids[0]=1&ids[1]=2&ids[2]=3
  7757. for (var i = 0; i < value.length; i++) {
  7758. _result.push(key + '[' + i + ']=' + value[i]);
  7759. }
  7760. break;
  7761. case 'brackets':
  7762. // 结果: ids[]=1&ids[]=2&ids[]=3
  7763. value.forEach(function (_value) {
  7764. _result.push(key + '[]=' + _value);
  7765. });
  7766. break;
  7767. case 'repeat':
  7768. // 结果: ids=1&ids=2&ids=3
  7769. value.forEach(function (_value) {
  7770. _result.push(key + '=' + _value);
  7771. });
  7772. break;
  7773. case 'comma':
  7774. // 结果: ids=1,2,3
  7775. var commaStr = "";
  7776. value.forEach(function (_value) {
  7777. commaStr += (commaStr ? "," : "") + _value;
  7778. });
  7779. _result.push(key + '=' + commaStr);
  7780. break;
  7781. default:
  7782. value.forEach(function (_value) {
  7783. _result.push(key + '[]=' + _value);
  7784. });}
  7785. } else {
  7786. _result.push(key + '=' + value);
  7787. }};for (var key in data) {var _ret = _loop(key);if (_ret === "continue") continue;
  7788. }
  7789. return _result.length ? prefix + _result.join('&') : '';
  7790. }var _default =
  7791. queryParams;exports.default = _default;
  7792. /***/ }),
  7793. /* 18 */
  7794. /*!************************************************************************************!*\
  7795. !*** D:/yin/workspace/uni-app/BLEApp/node_modules/uview-ui/libs/function/route.js ***!
  7796. \************************************************************************************/
  7797. /*! no static exports found */
  7798. /***/ (function(module, exports, __webpack_require__) {
  7799. "use strict";
  7800. /* WEBPACK VAR INJECTION */(function(uni) {Object.defineProperty(exports, "__esModule", { value: true });exports.default = void 0;var _regenerator = _interopRequireDefault(__webpack_require__(/*! ./node_modules/@babel/runtime/regenerator */ 19));function _interopRequireDefault(obj) {return obj && obj.__esModule ? obj : { default: obj };}function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) {try {var info = gen[key](arg);var value = info.value;} catch (error) {reject(error);return;}if (info.done) {resolve(value);} else {Promise.resolve(value).then(_next, _throw);}}function _asyncToGenerator(fn) {return function () {var self = this,args = arguments;return new Promise(function (resolve, reject) {var gen = fn.apply(self, args);function _next(value) {asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value);}function _throw(err) {asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err);}_next(undefined);});};}function _classCallCheck(instance, Constructor) {if (!(instance instanceof Constructor)) {throw new TypeError("Cannot call a class as a function");}}function _defineProperties(target, props) {for (var i = 0; i < props.length; i++) {var descriptor = props[i];descriptor.enumerable = descriptor.enumerable || false;descriptor.configurable = true;if ("value" in descriptor) descriptor.writable = true;Object.defineProperty(target, descriptor.key, descriptor);}}function _createClass(Constructor, protoProps, staticProps) {if (protoProps) _defineProperties(Constructor.prototype, protoProps);if (staticProps) _defineProperties(Constructor, staticProps);return Constructor;} /**
  7801. * 路由跳转方法该方法相对于直接使用uni.xxx的好处是使用更加简单快捷
  7802. * 并且带有路由拦截功能
  7803. */var
  7804. Router = /*#__PURE__*/function () {
  7805. function Router() {_classCallCheck(this, Router);
  7806. // 原始属性定义
  7807. this.config = {
  7808. type: 'navigateTo',
  7809. url: '',
  7810. delta: 1, // navigateBack页面后退时,回退的层数
  7811. params: {}, // 传递的参数
  7812. animationType: 'pop-in', // 窗口动画,只在APP有效
  7813. animationDuration: 300, // 窗口动画持续时间,单位毫秒,只在APP有效
  7814. intercept: false // 是否需要拦截
  7815. };
  7816. // 因为route方法是需要对外赋值给另外的对象使用,同时route内部有使用this,会导致route失去上下文
  7817. // 这里在构造函数中进行this绑定
  7818. this.route = this.route.bind(this);
  7819. }
  7820. // 判断url前面是否有"/",如果没有则加上,否则无法跳转
  7821. _createClass(Router, [{ key: "addRootPath", value: function addRootPath(url) {
  7822. return url[0] === '/' ? url : "/".concat(url);
  7823. }
  7824. // 整合路由参数
  7825. }, { key: "mixinParam", value: function mixinParam(url, params) {
  7826. url = url && this.addRootPath(url);
  7827. // 使用正则匹配,主要依据是判断是否有"/","?","="等,如“/page/index/index?name=mary"
  7828. // 如果有url中有get参数,转换后无需带上"?"
  7829. var query = '';
  7830. if (/.*\/.*\?.*=.*/.test(url)) {
  7831. // object对象转为get类型的参数
  7832. query = uni.$u.queryParams(params, false);
  7833. // 因为已有get参数,所以后面拼接的参数需要带上"&"隔开
  7834. return url += "&" + query;
  7835. } else {
  7836. // 直接拼接参数,因为此处url中没有后面的query参数,也就没有"?/&"之类的符号
  7837. query = uni.$u.queryParams(params);
  7838. return url += query;
  7839. }
  7840. }
  7841. // 对外的方法名称
  7842. }, { key: "route", value: function () {var _route = _asyncToGenerator( /*#__PURE__*/_regenerator.default.mark(function _callee() {var options,params,mergeConfig,isNext,_args = arguments;return _regenerator.default.wrap(function _callee$(_context) {while (1) {switch (_context.prev = _context.next) {case 0:options = _args.length > 0 && _args[0] !== undefined ? _args[0] : {};params = _args.length > 1 && _args[1] !== undefined ? _args[1] : {};
  7843. // 合并用户的配置和内部的默认配置
  7844. mergeConfig = {};
  7845. if (typeof options === 'string') {
  7846. // 如果options为字符串,则为route(url, params)的形式
  7847. mergeConfig.url = this.mixinParam(options, params);
  7848. mergeConfig.type = 'navigateTo';
  7849. } else {
  7850. mergeConfig = uni.$u.deepClone(options, this.config);
  7851. // 否则正常使用mergeConfig中的url和params进行拼接
  7852. mergeConfig.url = this.mixinParam(options.url, options.params);
  7853. }
  7854. if (params.intercept) {
  7855. this.config.intercept = params.intercept;
  7856. }
  7857. // params参数也带给拦截器
  7858. mergeConfig.params = params;
  7859. // 合并内外部参数
  7860. mergeConfig = uni.$u.deepMerge(this.config, mergeConfig);
  7861. // 判断用户是否定义了拦截器
  7862. if (!(typeof uni.$u.routeIntercept === 'function')) {_context.next = 14;break;}_context.next = 10;return (
  7863. new Promise(function (resolve, reject) {
  7864. uni.$u.routeIntercept(mergeConfig, resolve);
  7865. }));case 10:isNext = _context.sent;
  7866. // 如果isNext为true,则执行路由跳转
  7867. isNext && this.openPage(mergeConfig);_context.next = 15;break;case 14:
  7868. this.openPage(mergeConfig);case 15:case "end":return _context.stop();}}}, _callee, this);}));function route() {return _route.apply(this, arguments);}return route;}()
  7869. // 执行路由跳转
  7870. }, { key: "openPage", value: function openPage(config) {
  7871. // 解构参数
  7872. var
  7873. url =
  7874. config.url,type = config.type,delta = config.delta,animationType = config.animationType,animationDuration = config.animationDuration;
  7875. if (config.type == 'navigateTo' || config.type == 'to') {
  7876. uni.navigateTo({
  7877. url: url,
  7878. animationType: animationType,
  7879. animationDuration: animationDuration });
  7880. }
  7881. if (config.type == 'redirectTo' || config.type == 'redirect') {
  7882. uni.redirectTo({
  7883. url: url });
  7884. }
  7885. if (config.type == 'switchTab' || config.type == 'tab') {
  7886. uni.switchTab({
  7887. url: url });
  7888. }
  7889. if (config.type == 'reLaunch' || config.type == 'launch') {
  7890. uni.reLaunch({
  7891. url: url });
  7892. }
  7893. if (config.type == 'navigateBack' || config.type == 'back') {
  7894. uni.navigateBack({
  7895. delta: delta });
  7896. }
  7897. } }]);return Router;}();var _default =
  7898. new Router().route;exports.default = _default;
  7899. /* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./node_modules/@dcloudio/uni-mp-weixin/dist/index.js */ 1)["default"]))
  7900. /***/ }),
  7901. /* 19 */
  7902. /*!**********************************************************!*\
  7903. !*** ./node_modules/@babel/runtime/regenerator/index.js ***!
  7904. \**********************************************************/
  7905. /*! no static exports found */
  7906. /***/ (function(module, exports, __webpack_require__) {
  7907. module.exports = __webpack_require__(/*! regenerator-runtime */ 20);
  7908. /***/ }),
  7909. /* 20 */
  7910. /*!************************************************************!*\
  7911. !*** ./node_modules/regenerator-runtime/runtime-module.js ***!
  7912. \************************************************************/
  7913. /*! no static exports found */
  7914. /***/ (function(module, exports, __webpack_require__) {
  7915. /**
  7916. * Copyright (c) 2014-present, Facebook, Inc.
  7917. *
  7918. * This source code is licensed under the MIT license found in the
  7919. * LICENSE file in the root directory of this source tree.
  7920. */
  7921. // This method of obtaining a reference to the global object needs to be
  7922. // kept identical to the way it is obtained in runtime.js
  7923. var g = (function() {
  7924. return this || (typeof self === "object" && self);
  7925. })() || Function("return this")();
  7926. // Use `getOwnPropertyNames` because not all browsers support calling
  7927. // `hasOwnProperty` on the global `self` object in a worker. See #183.
  7928. var hadRuntime = g.regeneratorRuntime &&
  7929. Object.getOwnPropertyNames(g).indexOf("regeneratorRuntime") >= 0;
  7930. // Save the old regeneratorRuntime in case it needs to be restored later.
  7931. var oldRuntime = hadRuntime && g.regeneratorRuntime;
  7932. // Force reevalutation of runtime.js.
  7933. g.regeneratorRuntime = undefined;
  7934. module.exports = __webpack_require__(/*! ./runtime */ 21);
  7935. if (hadRuntime) {
  7936. // Restore the original runtime.
  7937. g.regeneratorRuntime = oldRuntime;
  7938. } else {
  7939. // Remove the global property added by runtime.js.
  7940. try {
  7941. delete g.regeneratorRuntime;
  7942. } catch(e) {
  7943. g.regeneratorRuntime = undefined;
  7944. }
  7945. }
  7946. /***/ }),
  7947. /* 21 */
  7948. /*!*****************************************************!*\
  7949. !*** ./node_modules/regenerator-runtime/runtime.js ***!
  7950. \*****************************************************/
  7951. /*! no static exports found */
  7952. /***/ (function(module, exports) {
  7953. /**
  7954. * Copyright (c) 2014-present, Facebook, Inc.
  7955. *
  7956. * This source code is licensed under the MIT license found in the
  7957. * LICENSE file in the root directory of this source tree.
  7958. */
  7959. !(function(global) {
  7960. "use strict";
  7961. var Op = Object.prototype;
  7962. var hasOwn = Op.hasOwnProperty;
  7963. var undefined; // More compressible than void 0.
  7964. var $Symbol = typeof Symbol === "function" ? Symbol : {};
  7965. var iteratorSymbol = $Symbol.iterator || "@@iterator";
  7966. var asyncIteratorSymbol = $Symbol.asyncIterator || "@@asyncIterator";
  7967. var toStringTagSymbol = $Symbol.toStringTag || "@@toStringTag";
  7968. var inModule = typeof module === "object";
  7969. var runtime = global.regeneratorRuntime;
  7970. if (runtime) {
  7971. if (inModule) {
  7972. // If regeneratorRuntime is defined globally and we're in a module,
  7973. // make the exports object identical to regeneratorRuntime.
  7974. module.exports = runtime;
  7975. }
  7976. // Don't bother evaluating the rest of this file if the runtime was
  7977. // already defined globally.
  7978. return;
  7979. }
  7980. // Define the runtime globally (as expected by generated code) as either
  7981. // module.exports (if we're in a module) or a new, empty object.
  7982. runtime = global.regeneratorRuntime = inModule ? module.exports : {};
  7983. function wrap(innerFn, outerFn, self, tryLocsList) {
  7984. // If outerFn provided and outerFn.prototype is a Generator, then outerFn.prototype instanceof Generator.
  7985. var protoGenerator = outerFn && outerFn.prototype instanceof Generator ? outerFn : Generator;
  7986. var generator = Object.create(protoGenerator.prototype);
  7987. var context = new Context(tryLocsList || []);
  7988. // The ._invoke method unifies the implementations of the .next,
  7989. // .throw, and .return methods.
  7990. generator._invoke = makeInvokeMethod(innerFn, self, context);
  7991. return generator;
  7992. }
  7993. runtime.wrap = wrap;
  7994. // Try/catch helper to minimize deoptimizations. Returns a completion
  7995. // record like context.tryEntries[i].completion. This interface could
  7996. // have been (and was previously) designed to take a closure to be
  7997. // invoked without arguments, but in all the cases we care about we
  7998. // already have an existing method we want to call, so there's no need
  7999. // to create a new function object. We can even get away with assuming
  8000. // the method takes exactly one argument, since that happens to be true
  8001. // in every case, so we don't have to touch the arguments object. The
  8002. // only additional allocation required is the completion record, which
  8003. // has a stable shape and so hopefully should be cheap to allocate.
  8004. function tryCatch(fn, obj, arg) {
  8005. try {
  8006. return { type: "normal", arg: fn.call(obj, arg) };
  8007. } catch (err) {
  8008. return { type: "throw", arg: err };
  8009. }
  8010. }
  8011. var GenStateSuspendedStart = "suspendedStart";
  8012. var GenStateSuspendedYield = "suspendedYield";
  8013. var GenStateExecuting = "executing";
  8014. var GenStateCompleted = "completed";
  8015. // Returning this object from the innerFn has the same effect as
  8016. // breaking out of the dispatch switch statement.
  8017. var ContinueSentinel = {};
  8018. // Dummy constructor functions that we use as the .constructor and
  8019. // .constructor.prototype properties for functions that return Generator
  8020. // objects. For full spec compliance, you may wish to configure your
  8021. // minifier not to mangle the names of these two functions.
  8022. function Generator() {}
  8023. function GeneratorFunction() {}
  8024. function GeneratorFunctionPrototype() {}
  8025. // This is a polyfill for %IteratorPrototype% for environments that
  8026. // don't natively support it.
  8027. var IteratorPrototype = {};
  8028. IteratorPrototype[iteratorSymbol] = function () {
  8029. return this;
  8030. };
  8031. var getProto = Object.getPrototypeOf;
  8032. var NativeIteratorPrototype = getProto && getProto(getProto(values([])));
  8033. if (NativeIteratorPrototype &&
  8034. NativeIteratorPrototype !== Op &&
  8035. hasOwn.call(NativeIteratorPrototype, iteratorSymbol)) {
  8036. // This environment has a native %IteratorPrototype%; use it instead
  8037. // of the polyfill.
  8038. IteratorPrototype = NativeIteratorPrototype;
  8039. }
  8040. var Gp = GeneratorFunctionPrototype.prototype =
  8041. Generator.prototype = Object.create(IteratorPrototype);
  8042. GeneratorFunction.prototype = Gp.constructor = GeneratorFunctionPrototype;
  8043. GeneratorFunctionPrototype.constructor = GeneratorFunction;
  8044. GeneratorFunctionPrototype[toStringTagSymbol] =
  8045. GeneratorFunction.displayName = "GeneratorFunction";
  8046. // Helper for defining the .next, .throw, and .return methods of the
  8047. // Iterator interface in terms of a single ._invoke method.
  8048. function defineIteratorMethods(prototype) {
  8049. ["next", "throw", "return"].forEach(function(method) {
  8050. prototype[method] = function(arg) {
  8051. return this._invoke(method, arg);
  8052. };
  8053. });
  8054. }
  8055. runtime.isGeneratorFunction = function(genFun) {
  8056. var ctor = typeof genFun === "function" && genFun.constructor;
  8057. return ctor
  8058. ? ctor === GeneratorFunction ||
  8059. // For the native GeneratorFunction constructor, the best we can
  8060. // do is to check its .name property.
  8061. (ctor.displayName || ctor.name) === "GeneratorFunction"
  8062. : false;
  8063. };
  8064. runtime.mark = function(genFun) {
  8065. if (Object.setPrototypeOf) {
  8066. Object.setPrototypeOf(genFun, GeneratorFunctionPrototype);
  8067. } else {
  8068. genFun.__proto__ = GeneratorFunctionPrototype;
  8069. if (!(toStringTagSymbol in genFun)) {
  8070. genFun[toStringTagSymbol] = "GeneratorFunction";
  8071. }
  8072. }
  8073. genFun.prototype = Object.create(Gp);
  8074. return genFun;
  8075. };
  8076. // Within the body of any async function, `await x` is transformed to
  8077. // `yield regeneratorRuntime.awrap(x)`, so that the runtime can test
  8078. // `hasOwn.call(value, "__await")` to determine if the yielded value is
  8079. // meant to be awaited.
  8080. runtime.awrap = function(arg) {
  8081. return { __await: arg };
  8082. };
  8083. function AsyncIterator(generator) {
  8084. function invoke(method, arg, resolve, reject) {
  8085. var record = tryCatch(generator[method], generator, arg);
  8086. if (record.type === "throw") {
  8087. reject(record.arg);
  8088. } else {
  8089. var result = record.arg;
  8090. var value = result.value;
  8091. if (value &&
  8092. typeof value === "object" &&
  8093. hasOwn.call(value, "__await")) {
  8094. return Promise.resolve(value.__await).then(function(value) {
  8095. invoke("next", value, resolve, reject);
  8096. }, function(err) {
  8097. invoke("throw", err, resolve, reject);
  8098. });
  8099. }
  8100. return Promise.resolve(value).then(function(unwrapped) {
  8101. // When a yielded Promise is resolved, its final value becomes
  8102. // the .value of the Promise<{value,done}> result for the
  8103. // current iteration.
  8104. result.value = unwrapped;
  8105. resolve(result);
  8106. }, function(error) {
  8107. // If a rejected Promise was yielded, throw the rejection back
  8108. // into the async generator function so it can be handled there.
  8109. return invoke("throw", error, resolve, reject);
  8110. });
  8111. }
  8112. }
  8113. var previousPromise;
  8114. function enqueue(method, arg) {
  8115. function callInvokeWithMethodAndArg() {
  8116. return new Promise(function(resolve, reject) {
  8117. invoke(method, arg, resolve, reject);
  8118. });
  8119. }
  8120. return previousPromise =
  8121. // If enqueue has been called before, then we want to wait until
  8122. // all previous Promises have been resolved before calling invoke,
  8123. // so that results are always delivered in the correct order. If
  8124. // enqueue has not been called before, then it is important to
  8125. // call invoke immediately, without waiting on a callback to fire,
  8126. // so that the async generator function has the opportunity to do
  8127. // any necessary setup in a predictable way. This predictability
  8128. // is why the Promise constructor synchronously invokes its
  8129. // executor callback, and why async functions synchronously
  8130. // execute code before the first await. Since we implement simple
  8131. // async functions in terms of async generators, it is especially
  8132. // important to get this right, even though it requires care.
  8133. previousPromise ? previousPromise.then(
  8134. callInvokeWithMethodAndArg,
  8135. // Avoid propagating failures to Promises returned by later
  8136. // invocations of the iterator.
  8137. callInvokeWithMethodAndArg
  8138. ) : callInvokeWithMethodAndArg();
  8139. }
  8140. // Define the unified helper method that is used to implement .next,
  8141. // .throw, and .return (see defineIteratorMethods).
  8142. this._invoke = enqueue;
  8143. }
  8144. defineIteratorMethods(AsyncIterator.prototype);
  8145. AsyncIterator.prototype[asyncIteratorSymbol] = function () {
  8146. return this;
  8147. };
  8148. runtime.AsyncIterator = AsyncIterator;
  8149. // Note that simple async functions are implemented on top of
  8150. // AsyncIterator objects; they just return a Promise for the value of
  8151. // the final result produced by the iterator.
  8152. runtime.async = function(innerFn, outerFn, self, tryLocsList) {
  8153. var iter = new AsyncIterator(
  8154. wrap(innerFn, outerFn, self, tryLocsList)
  8155. );
  8156. return runtime.isGeneratorFunction(outerFn)
  8157. ? iter // If outerFn is a generator, return the full iterator.
  8158. : iter.next().then(function(result) {
  8159. return result.done ? result.value : iter.next();
  8160. });
  8161. };
  8162. function makeInvokeMethod(innerFn, self, context) {
  8163. var state = GenStateSuspendedStart;
  8164. return function invoke(method, arg) {
  8165. if (state === GenStateExecuting) {
  8166. throw new Error("Generator is already running");
  8167. }
  8168. if (state === GenStateCompleted) {
  8169. if (method === "throw") {
  8170. throw arg;
  8171. }
  8172. // Be forgiving, per 25.3.3.3.3 of the spec:
  8173. // https://people.mozilla.org/~jorendorff/es6-draft.html#sec-generatorresume
  8174. return doneResult();
  8175. }
  8176. context.method = method;
  8177. context.arg = arg;
  8178. while (true) {
  8179. var delegate = context.delegate;
  8180. if (delegate) {
  8181. var delegateResult = maybeInvokeDelegate(delegate, context);
  8182. if (delegateResult) {
  8183. if (delegateResult === ContinueSentinel) continue;
  8184. return delegateResult;
  8185. }
  8186. }
  8187. if (context.method === "next") {
  8188. // Setting context._sent for legacy support of Babel's
  8189. // function.sent implementation.
  8190. context.sent = context._sent = context.arg;
  8191. } else if (context.method === "throw") {
  8192. if (state === GenStateSuspendedStart) {
  8193. state = GenStateCompleted;
  8194. throw context.arg;
  8195. }
  8196. context.dispatchException(context.arg);
  8197. } else if (context.method === "return") {
  8198. context.abrupt("return", context.arg);
  8199. }
  8200. state = GenStateExecuting;
  8201. var record = tryCatch(innerFn, self, context);
  8202. if (record.type === "normal") {
  8203. // If an exception is thrown from innerFn, we leave state ===
  8204. // GenStateExecuting and loop back for another invocation.
  8205. state = context.done
  8206. ? GenStateCompleted
  8207. : GenStateSuspendedYield;
  8208. if (record.arg === ContinueSentinel) {
  8209. continue;
  8210. }
  8211. return {
  8212. value: record.arg,
  8213. done: context.done
  8214. };
  8215. } else if (record.type === "throw") {
  8216. state = GenStateCompleted;
  8217. // Dispatch the exception by looping back around to the
  8218. // context.dispatchException(context.arg) call above.
  8219. context.method = "throw";
  8220. context.arg = record.arg;
  8221. }
  8222. }
  8223. };
  8224. }
  8225. // Call delegate.iterator[context.method](context.arg) and handle the
  8226. // result, either by returning a { value, done } result from the
  8227. // delegate iterator, or by modifying context.method and context.arg,
  8228. // setting context.delegate to null, and returning the ContinueSentinel.
  8229. function maybeInvokeDelegate(delegate, context) {
  8230. var method = delegate.iterator[context.method];
  8231. if (method === undefined) {
  8232. // A .throw or .return when the delegate iterator has no .throw
  8233. // method always terminates the yield* loop.
  8234. context.delegate = null;
  8235. if (context.method === "throw") {
  8236. if (delegate.iterator.return) {
  8237. // If the delegate iterator has a return method, give it a
  8238. // chance to clean up.
  8239. context.method = "return";
  8240. context.arg = undefined;
  8241. maybeInvokeDelegate(delegate, context);
  8242. if (context.method === "throw") {
  8243. // If maybeInvokeDelegate(context) changed context.method from
  8244. // "return" to "throw", let that override the TypeError below.
  8245. return ContinueSentinel;
  8246. }
  8247. }
  8248. context.method = "throw";
  8249. context.arg = new TypeError(
  8250. "The iterator does not provide a 'throw' method");
  8251. }
  8252. return ContinueSentinel;
  8253. }
  8254. var record = tryCatch(method, delegate.iterator, context.arg);
  8255. if (record.type === "throw") {
  8256. context.method = "throw";
  8257. context.arg = record.arg;
  8258. context.delegate = null;
  8259. return ContinueSentinel;
  8260. }
  8261. var info = record.arg;
  8262. if (! info) {
  8263. context.method = "throw";
  8264. context.arg = new TypeError("iterator result is not an object");
  8265. context.delegate = null;
  8266. return ContinueSentinel;
  8267. }
  8268. if (info.done) {
  8269. // Assign the result of the finished delegate to the temporary
  8270. // variable specified by delegate.resultName (see delegateYield).
  8271. context[delegate.resultName] = info.value;
  8272. // Resume execution at the desired location (see delegateYield).
  8273. context.next = delegate.nextLoc;
  8274. // If context.method was "throw" but the delegate handled the
  8275. // exception, let the outer generator proceed normally. If
  8276. // context.method was "next", forget context.arg since it has been
  8277. // "consumed" by the delegate iterator. If context.method was
  8278. // "return", allow the original .return call to continue in the
  8279. // outer generator.
  8280. if (context.method !== "return") {
  8281. context.method = "next";
  8282. context.arg = undefined;
  8283. }
  8284. } else {
  8285. // Re-yield the result returned by the delegate method.
  8286. return info;
  8287. }
  8288. // The delegate iterator is finished, so forget it and continue with
  8289. // the outer generator.
  8290. context.delegate = null;
  8291. return ContinueSentinel;
  8292. }
  8293. // Define Generator.prototype.{next,throw,return} in terms of the
  8294. // unified ._invoke helper method.
  8295. defineIteratorMethods(Gp);
  8296. Gp[toStringTagSymbol] = "Generator";
  8297. // A Generator should always return itself as the iterator object when the
  8298. // @@iterator function is called on it. Some browsers' implementations of the
  8299. // iterator prototype chain incorrectly implement this, causing the Generator
  8300. // object to not be returned from this call. This ensures that doesn't happen.
  8301. // See https://github.com/facebook/regenerator/issues/274 for more details.
  8302. Gp[iteratorSymbol] = function() {
  8303. return this;
  8304. };
  8305. Gp.toString = function() {
  8306. return "[object Generator]";
  8307. };
  8308. function pushTryEntry(locs) {
  8309. var entry = { tryLoc: locs[0] };
  8310. if (1 in locs) {
  8311. entry.catchLoc = locs[1];
  8312. }
  8313. if (2 in locs) {
  8314. entry.finallyLoc = locs[2];
  8315. entry.afterLoc = locs[3];
  8316. }
  8317. this.tryEntries.push(entry);
  8318. }
  8319. function resetTryEntry(entry) {
  8320. var record = entry.completion || {};
  8321. record.type = "normal";
  8322. delete record.arg;
  8323. entry.completion = record;
  8324. }
  8325. function Context(tryLocsList) {
  8326. // The root entry object (effectively a try statement without a catch
  8327. // or a finally block) gives us a place to store values thrown from
  8328. // locations where there is no enclosing try statement.
  8329. this.tryEntries = [{ tryLoc: "root" }];
  8330. tryLocsList.forEach(pushTryEntry, this);
  8331. this.reset(true);
  8332. }
  8333. runtime.keys = function(object) {
  8334. var keys = [];
  8335. for (var key in object) {
  8336. keys.push(key);
  8337. }
  8338. keys.reverse();
  8339. // Rather than returning an object with a next method, we keep
  8340. // things simple and return the next function itself.
  8341. return function next() {
  8342. while (keys.length) {
  8343. var key = keys.pop();
  8344. if (key in object) {
  8345. next.value = key;
  8346. next.done = false;
  8347. return next;
  8348. }
  8349. }
  8350. // To avoid creating an additional object, we just hang the .value
  8351. // and .done properties off the next function object itself. This
  8352. // also ensures that the minifier will not anonymize the function.
  8353. next.done = true;
  8354. return next;
  8355. };
  8356. };
  8357. function values(iterable) {
  8358. if (iterable) {
  8359. var iteratorMethod = iterable[iteratorSymbol];
  8360. if (iteratorMethod) {
  8361. return iteratorMethod.call(iterable);
  8362. }
  8363. if (typeof iterable.next === "function") {
  8364. return iterable;
  8365. }
  8366. if (!isNaN(iterable.length)) {
  8367. var i = -1, next = function next() {
  8368. while (++i < iterable.length) {
  8369. if (hasOwn.call(iterable, i)) {
  8370. next.value = iterable[i];
  8371. next.done = false;
  8372. return next;
  8373. }
  8374. }
  8375. next.value = undefined;
  8376. next.done = true;
  8377. return next;
  8378. };
  8379. return next.next = next;
  8380. }
  8381. }
  8382. // Return an iterator with no values.
  8383. return { next: doneResult };
  8384. }
  8385. runtime.values = values;
  8386. function doneResult() {
  8387. return { value: undefined, done: true };
  8388. }
  8389. Context.prototype = {
  8390. constructor: Context,
  8391. reset: function(skipTempReset) {
  8392. this.prev = 0;
  8393. this.next = 0;
  8394. // Resetting context._sent for legacy support of Babel's
  8395. // function.sent implementation.
  8396. this.sent = this._sent = undefined;
  8397. this.done = false;
  8398. this.delegate = null;
  8399. this.method = "next";
  8400. this.arg = undefined;
  8401. this.tryEntries.forEach(resetTryEntry);
  8402. if (!skipTempReset) {
  8403. for (var name in this) {
  8404. // Not sure about the optimal order of these conditions:
  8405. if (name.charAt(0) === "t" &&
  8406. hasOwn.call(this, name) &&
  8407. !isNaN(+name.slice(1))) {
  8408. this[name] = undefined;
  8409. }
  8410. }
  8411. }
  8412. },
  8413. stop: function() {
  8414. this.done = true;
  8415. var rootEntry = this.tryEntries[0];
  8416. var rootRecord = rootEntry.completion;
  8417. if (rootRecord.type === "throw") {
  8418. throw rootRecord.arg;
  8419. }
  8420. return this.rval;
  8421. },
  8422. dispatchException: function(exception) {
  8423. if (this.done) {
  8424. throw exception;
  8425. }
  8426. var context = this;
  8427. function handle(loc, caught) {
  8428. record.type = "throw";
  8429. record.arg = exception;
  8430. context.next = loc;
  8431. if (caught) {
  8432. // If the dispatched exception was caught by a catch block,
  8433. // then let that catch block handle the exception normally.
  8434. context.method = "next";
  8435. context.arg = undefined;
  8436. }
  8437. return !! caught;
  8438. }
  8439. for (var i = this.tryEntries.length - 1; i >= 0; --i) {
  8440. var entry = this.tryEntries[i];
  8441. var record = entry.completion;
  8442. if (entry.tryLoc === "root") {
  8443. // Exception thrown outside of any try block that could handle
  8444. // it, so set the completion value of the entire function to
  8445. // throw the exception.
  8446. return handle("end");
  8447. }
  8448. if (entry.tryLoc <= this.prev) {
  8449. var hasCatch = hasOwn.call(entry, "catchLoc");
  8450. var hasFinally = hasOwn.call(entry, "finallyLoc");
  8451. if (hasCatch && hasFinally) {
  8452. if (this.prev < entry.catchLoc) {
  8453. return handle(entry.catchLoc, true);
  8454. } else if (this.prev < entry.finallyLoc) {
  8455. return handle(entry.finallyLoc);
  8456. }
  8457. } else if (hasCatch) {
  8458. if (this.prev < entry.catchLoc) {
  8459. return handle(entry.catchLoc, true);
  8460. }
  8461. } else if (hasFinally) {
  8462. if (this.prev < entry.finallyLoc) {
  8463. return handle(entry.finallyLoc);
  8464. }
  8465. } else {
  8466. throw new Error("try statement without catch or finally");
  8467. }
  8468. }
  8469. }
  8470. },
  8471. abrupt: function(type, arg) {
  8472. for (var i = this.tryEntries.length - 1; i >= 0; --i) {
  8473. var entry = this.tryEntries[i];
  8474. if (entry.tryLoc <= this.prev &&
  8475. hasOwn.call(entry, "finallyLoc") &&
  8476. this.prev < entry.finallyLoc) {
  8477. var finallyEntry = entry;
  8478. break;
  8479. }
  8480. }
  8481. if (finallyEntry &&
  8482. (type === "break" ||
  8483. type === "continue") &&
  8484. finallyEntry.tryLoc <= arg &&
  8485. arg <= finallyEntry.finallyLoc) {
  8486. // Ignore the finally entry if control is not jumping to a
  8487. // location outside the try/catch block.
  8488. finallyEntry = null;
  8489. }
  8490. var record = finallyEntry ? finallyEntry.completion : {};
  8491. record.type = type;
  8492. record.arg = arg;
  8493. if (finallyEntry) {
  8494. this.method = "next";
  8495. this.next = finallyEntry.finallyLoc;
  8496. return ContinueSentinel;
  8497. }
  8498. return this.complete(record);
  8499. },
  8500. complete: function(record, afterLoc) {
  8501. if (record.type === "throw") {
  8502. throw record.arg;
  8503. }
  8504. if (record.type === "break" ||
  8505. record.type === "continue") {
  8506. this.next = record.arg;
  8507. } else if (record.type === "return") {
  8508. this.rval = this.arg = record.arg;
  8509. this.method = "return";
  8510. this.next = "end";
  8511. } else if (record.type === "normal" && afterLoc) {
  8512. this.next = afterLoc;
  8513. }
  8514. return ContinueSentinel;
  8515. },
  8516. finish: function(finallyLoc) {
  8517. for (var i = this.tryEntries.length - 1; i >= 0; --i) {
  8518. var entry = this.tryEntries[i];
  8519. if (entry.finallyLoc === finallyLoc) {
  8520. this.complete(entry.completion, entry.afterLoc);
  8521. resetTryEntry(entry);
  8522. return ContinueSentinel;
  8523. }
  8524. }
  8525. },
  8526. "catch": function(tryLoc) {
  8527. for (var i = this.tryEntries.length - 1; i >= 0; --i) {
  8528. var entry = this.tryEntries[i];
  8529. if (entry.tryLoc === tryLoc) {
  8530. var record = entry.completion;
  8531. if (record.type === "throw") {
  8532. var thrown = record.arg;
  8533. resetTryEntry(entry);
  8534. }
  8535. return thrown;
  8536. }
  8537. }
  8538. // The context.catch method must only be called with a location
  8539. // argument that corresponds to a known catch block.
  8540. throw new Error("illegal catch attempt");
  8541. },
  8542. delegateYield: function(iterable, resultName, nextLoc) {
  8543. this.delegate = {
  8544. iterator: values(iterable),
  8545. resultName: resultName,
  8546. nextLoc: nextLoc
  8547. };
  8548. if (this.method === "next") {
  8549. // Deliberately forget the last sent value so that we don't
  8550. // accidentally pass it on to the delegate.
  8551. this.arg = undefined;
  8552. }
  8553. return ContinueSentinel;
  8554. }
  8555. };
  8556. })(
  8557. // In sloppy mode, unbound `this` refers to the global object, fallback to
  8558. // Function constructor if we're in global strict mode. That is sadly a form
  8559. // of indirect eval which violates Content Security Policy.
  8560. (function() {
  8561. return this || (typeof self === "object" && self);
  8562. })() || Function("return this")()
  8563. );
  8564. /***/ }),
  8565. /* 22 */
  8566. /*!*****************************************************************************************!*\
  8567. !*** D:/yin/workspace/uni-app/BLEApp/node_modules/uview-ui/libs/function/timeFormat.js ***!
  8568. \*****************************************************************************************/
  8569. /*! no static exports found */
  8570. /***/ (function(module, exports, __webpack_require__) {
  8571. "use strict";
  8572. Object.defineProperty(exports, "__esModule", { value: true });exports.default = void 0; // padStart 的 polyfill,因为某些机型或情况,还无法支持es7的padStart,比如电脑版的微信小程序
  8573. // 所以这里做一个兼容polyfill的兼容处理
  8574. if (!String.prototype.padStart) {
  8575. // 为了方便表示这里 fillString 用了ES6 的默认参数,不影响理解
  8576. String.prototype.padStart = function (maxLength) {var fillString = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : ' ';
  8577. if (Object.prototype.toString.call(fillString) !== "[object String]") throw new TypeError(
  8578. 'fillString must be String');
  8579. var str = this;
  8580. // 返回 String(str) 这里是为了使返回的值是字符串字面量,在控制台中更符合直觉
  8581. if (str.length >= maxLength) return String(str);
  8582. var fillLength = maxLength - str.length,
  8583. times = Math.ceil(fillLength / fillString.length);
  8584. while (times >>= 1) {
  8585. fillString += fillString;
  8586. if (times === 1) {
  8587. fillString += fillString;
  8588. }
  8589. }
  8590. return fillString.slice(0, fillLength) + str;
  8591. };
  8592. }
  8593. // 其他更多是格式化有如下:
  8594. // yyyy:mm:dd|yyyy:mm|yyyy年mm月dd日|yyyy年mm月dd日 hh时MM分等,可自定义组合
  8595. function timeFormat() {var dateTime = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : null;var fmt = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'yyyy-mm-dd';
  8596. // 如果为null,则格式化当前时间
  8597. if (!dateTime) dateTime = Number(new Date());
  8598. // 如果dateTime长度为10或者13,则为秒和毫秒的时间戳,如果超过13位,则为其他的时间格式
  8599. if (dateTime.toString().length == 10) dateTime *= 1000;
  8600. var date = new Date(dateTime);
  8601. var ret;
  8602. var opt = {
  8603. "y+": date.getFullYear().toString(), // 年
  8604. "m+": (date.getMonth() + 1).toString(), // 月
  8605. "d+": date.getDate().toString(), // 日
  8606. "h+": date.getHours().toString(), // 时
  8607. "M+": date.getMinutes().toString(), // 分
  8608. "s+": date.getSeconds().toString() // 秒
  8609. // 有其他格式化字符需求可以继续添加,必须转化成字符串
  8610. };
  8611. for (var k in opt) {
  8612. ret = new RegExp("(" + k + ")").exec(fmt);
  8613. if (ret) {
  8614. fmt = fmt.replace(ret[1], ret[1].length == 1 ? opt[k] : opt[k].padStart(ret[1].length, "0"));
  8615. };
  8616. };
  8617. return fmt;
  8618. }var _default =
  8619. timeFormat;exports.default = _default;
  8620. /***/ }),
  8621. /* 23 */
  8622. /*!***************************************************************************************!*\
  8623. !*** D:/yin/workspace/uni-app/BLEApp/node_modules/uview-ui/libs/function/timeFrom.js ***!
  8624. \***************************************************************************************/
  8625. /*! no static exports found */
  8626. /***/ (function(module, exports, __webpack_require__) {
  8627. "use strict";
  8628. Object.defineProperty(exports, "__esModule", { value: true });exports.default = void 0;var _timeFormat = _interopRequireDefault(__webpack_require__(/*! ../../libs/function/timeFormat.js */ 22));function _interopRequireDefault(obj) {return obj && obj.__esModule ? obj : { default: obj };}
  8629. /**
  8630. * 时间戳转为多久之前
  8631. * @param String timestamp 时间戳
  8632. * @param String | Boolean format 如果为时间格式字符串超出一定时间范围返回固定的时间格式
  8633. * 如果为布尔值false无论什么时间都返回多久以前的格式
  8634. */
  8635. function timeFrom() {var dateTime = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : null;var format = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'yyyy-mm-dd';
  8636. // 如果为null,则格式化当前时间
  8637. if (!dateTime) dateTime = Number(new Date());
  8638. // 如果dateTime长度为10或者13,则为秒和毫秒的时间戳,如果超过13位,则为其他的时间格式
  8639. if (dateTime.toString().length == 10) dateTime *= 1000;
  8640. var timestamp = +new Date(Number(dateTime));
  8641. var timer = (Number(new Date()) - timestamp) / 1000;
  8642. // 如果小于5分钟,则返回"刚刚",其他以此类推
  8643. var tips = '';
  8644. switch (true) {
  8645. case timer < 300:
  8646. tips = '刚刚';
  8647. break;
  8648. case timer >= 300 && timer < 3600:
  8649. tips = parseInt(timer / 60) + '分钟前';
  8650. break;
  8651. case timer >= 3600 && timer < 86400:
  8652. tips = parseInt(timer / 3600) + '小时前';
  8653. break;
  8654. case timer >= 86400 && timer < 2592000:
  8655. tips = parseInt(timer / 86400) + '天前';
  8656. break;
  8657. default:
  8658. // 如果format为false,则无论什么时间戳,都显示xx之前
  8659. if (format === false) {
  8660. if (timer >= 2592000 && timer < 365 * 86400) {
  8661. tips = parseInt(timer / (86400 * 30)) + '个月前';
  8662. } else {
  8663. tips = parseInt(timer / (86400 * 365)) + '年前';
  8664. }
  8665. } else {
  8666. tips = (0, _timeFormat.default)(timestamp, format);
  8667. }}
  8668. return tips;
  8669. }var _default =
  8670. timeFrom;exports.default = _default;
  8671. /***/ }),
  8672. /* 24 */
  8673. /*!********************************************************************************************!*\
  8674. !*** D:/yin/workspace/uni-app/BLEApp/node_modules/uview-ui/libs/function/colorGradient.js ***!
  8675. \********************************************************************************************/
  8676. /*! no static exports found */
  8677. /***/ (function(module, exports, __webpack_require__) {
  8678. "use strict";
  8679. Object.defineProperty(exports, "__esModule", { value: true });exports.default = void 0; /**
  8680. * 求两个颜色之间的渐变值
  8681. * @param {string} startColor 开始的颜色
  8682. * @param {string} endColor 结束的颜色
  8683. * @param {number} step 颜色等分的份额
  8684. * */
  8685. function colorGradient() {var startColor = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 'rgb(0, 0, 0)';var endColor = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'rgb(255, 255, 255)';var step = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 10;
  8686. var startRGB = hexToRgb(startColor, false); //转换为rgb数组模式
  8687. var startR = startRGB[0];
  8688. var startG = startRGB[1];
  8689. var startB = startRGB[2];
  8690. var endRGB = hexToRgb(endColor, false);
  8691. var endR = endRGB[0];
  8692. var endG = endRGB[1];
  8693. var endB = endRGB[2];
  8694. var sR = (endR - startR) / step; //总差值
  8695. var sG = (endG - startG) / step;
  8696. var sB = (endB - startB) / step;
  8697. var colorArr = [];
  8698. for (var i = 0; i < step; i++) {
  8699. //计算每一步的hex值
  8700. var hex = rgbToHex('rgb(' + Math.round(sR * i + startR) + ',' + Math.round(sG * i + startG) + ',' + Math.round(sB *
  8701. i + startB) + ')');
  8702. colorArr.push(hex);
  8703. }
  8704. return colorArr;
  8705. }
  8706. // 将hex表示方式转换为rgb表示方式(这里返回rgb数组模式)
  8707. function hexToRgb(sColor) {var str = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
  8708. var reg = /^#([0-9a-fA-f]{3}|[0-9a-fA-f]{6})$/;
  8709. sColor = sColor.toLowerCase();
  8710. if (sColor && reg.test(sColor)) {
  8711. if (sColor.length === 4) {
  8712. var sColorNew = "#";
  8713. for (var i = 1; i < 4; i += 1) {
  8714. sColorNew += sColor.slice(i, i + 1).concat(sColor.slice(i, i + 1));
  8715. }
  8716. sColor = sColorNew;
  8717. }
  8718. //处理六位的颜色值
  8719. var sColorChange = [];
  8720. for (var _i = 1; _i < 7; _i += 2) {
  8721. sColorChange.push(parseInt("0x" + sColor.slice(_i, _i + 2)));
  8722. }
  8723. if (!str) {
  8724. return sColorChange;
  8725. } else {
  8726. return "rgb(".concat(sColorChange[0], ",").concat(sColorChange[1], ",").concat(sColorChange[2], ")");
  8727. }
  8728. } else if (/^(rgb|RGB)/.test(sColor)) {
  8729. var arr = sColor.replace(/(?:\(|\)|rgb|RGB)*/g, "").split(",");
  8730. return arr.map(function (val) {return Number(val);});
  8731. } else {
  8732. return sColor;
  8733. }
  8734. };
  8735. // 将rgb表示方式转换为hex表示方式
  8736. function rgbToHex(rgb) {
  8737. var _this = rgb;
  8738. var reg = /^#([0-9a-fA-f]{3}|[0-9a-fA-f]{6})$/;
  8739. if (/^(rgb|RGB)/.test(_this)) {
  8740. var aColor = _this.replace(/(?:\(|\)|rgb|RGB)*/g, "").split(",");
  8741. var strHex = "#";
  8742. for (var i = 0; i < aColor.length; i++) {
  8743. var hex = Number(aColor[i]).toString(16);
  8744. hex = String(hex).length == 1 ? 0 + '' + hex : hex; // 保证每个rgb的值为2位
  8745. if (hex === "0") {
  8746. hex += hex;
  8747. }
  8748. strHex += hex;
  8749. }
  8750. if (strHex.length !== 7) {
  8751. strHex = _this;
  8752. }
  8753. return strHex;
  8754. } else if (reg.test(_this)) {
  8755. var aNum = _this.replace(/#/, "").split("");
  8756. if (aNum.length === 6) {
  8757. return _this;
  8758. } else if (aNum.length === 3) {
  8759. var numHex = "#";
  8760. for (var _i2 = 0; _i2 < aNum.length; _i2 += 1) {
  8761. numHex += aNum[_i2] + aNum[_i2];
  8762. }
  8763. return numHex;
  8764. }
  8765. } else {
  8766. return _this;
  8767. }
  8768. }
  8769. /**
  8770. * JS颜色十六进制转换为rgb或rgba,返回的格式为 rgba2552552550.5字符串
  8771. * sHex为传入的十六进制的色值
  8772. * alpha为rgba的透明度
  8773. */
  8774. function colorToRgba(color) {var alpha = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0.3;
  8775. color = rgbToHex(color);
  8776. // 十六进制颜色值的正则表达式
  8777. var reg = /^#([0-9a-fA-f]{3}|[0-9a-fA-f]{6})$/;
  8778. /* 16进制颜色转为RGB格式 */
  8779. var sColor = color.toLowerCase();
  8780. if (sColor && reg.test(sColor)) {
  8781. if (sColor.length === 4) {
  8782. var sColorNew = '#';
  8783. for (var i = 1; i < 4; i += 1) {
  8784. sColorNew += sColor.slice(i, i + 1).concat(sColor.slice(i, i + 1));
  8785. }
  8786. sColor = sColorNew;
  8787. }
  8788. // 处理六位的颜色值
  8789. var sColorChange = [];
  8790. for (var _i3 = 1; _i3 < 7; _i3 += 2) {
  8791. sColorChange.push(parseInt('0x' + sColor.slice(_i3, _i3 + 2)));
  8792. }
  8793. // return sColorChange.join(',')
  8794. return 'rgba(' + sColorChange.join(',') + ',' + alpha + ')';
  8795. } else
  8796. {
  8797. return sColor;
  8798. }
  8799. }var _default =
  8800. {
  8801. colorGradient: colorGradient,
  8802. hexToRgb: hexToRgb,
  8803. rgbToHex: rgbToHex,
  8804. colorToRgba: colorToRgba };exports.default = _default;
  8805. /***/ }),
  8806. /* 25 */
  8807. /*!***********************************************************************************!*\
  8808. !*** D:/yin/workspace/uni-app/BLEApp/node_modules/uview-ui/libs/function/guid.js ***!
  8809. \***********************************************************************************/
  8810. /*! no static exports found */
  8811. /***/ (function(module, exports, __webpack_require__) {
  8812. "use strict";
  8813. Object.defineProperty(exports, "__esModule", { value: true });exports.default = void 0; /**
  8814. * 本算法来源于简书开源代码详见https://www.jianshu.com/p/fdbf293d0a85
  8815. * 全局唯一标识符uuidGlobally Unique Identifier,也称作 uuid(Universally Unique IDentifier)
  8816. * 一般用于多个组件之间,给它一个唯一的标识符,或者v-for循环的时候,如果使用数组的index可能会导致更新列表出现问题
  8817. * 最可能的情况是左滑删除item或者对某条信息流"不喜欢"并去掉它的时候,会导致组件内的数据可能出现错乱
  8818. * v-for的时候,推荐使用后端返回的id而不是循环的index
  8819. * @param {Number} len uuid的长度
  8820. * @param {Boolean} firstU 将返回的首字母置为"u"
  8821. * @param {Nubmer} radix 生成uuid的基数(意味着返回的字符串都是这个基数),2-二进制,8-八进制,10-十进制,16-十六进制
  8822. */
  8823. function guid() {var len = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 32;var firstU = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;var radix = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : null;
  8824. var chars = '0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz'.split('');
  8825. var uuid = [];
  8826. radix = radix || chars.length;
  8827. if (len) {
  8828. // 如果指定uuid长度,只是取随机的字符,0|x为位运算,能去掉x的小数位,返回整数位
  8829. for (var i = 0; i < len; i++) {uuid[i] = chars[0 | Math.random() * radix];}
  8830. } else {
  8831. var r;
  8832. // rfc4122标准要求返回的uuid中,某些位为固定的字符
  8833. uuid[8] = uuid[13] = uuid[18] = uuid[23] = '-';
  8834. uuid[14] = '4';
  8835. for (var _i = 0; _i < 36; _i++) {
  8836. if (!uuid[_i]) {
  8837. r = 0 | Math.random() * 16;
  8838. uuid[_i] = chars[_i == 19 ? r & 0x3 | 0x8 : r];
  8839. }
  8840. }
  8841. }
  8842. // 移除第一个字符,并用u替代,因为第一个字符为数值时,该guuid不能用作id或者class
  8843. if (firstU) {
  8844. uuid.shift();
  8845. return 'u' + uuid.join('');
  8846. } else {
  8847. return uuid.join('');
  8848. }
  8849. }var _default =
  8850. guid;exports.default = _default;
  8851. /***/ }),
  8852. /* 26 */
  8853. /*!************************************************************************************!*\
  8854. !*** D:/yin/workspace/uni-app/BLEApp/node_modules/uview-ui/libs/function/color.js ***!
  8855. \************************************************************************************/
  8856. /*! no static exports found */
  8857. /***/ (function(module, exports, __webpack_require__) {
  8858. "use strict";
  8859. Object.defineProperty(exports, "__esModule", { value: true });exports.default = void 0; // 为了让用户能够自定义主题,会逐步弃用此文件,各颜色通过css提供
  8860. // 为了给某些特殊场景使用和向后兼容,无需删除此文件(2020-06-20)
  8861. var color = {
  8862. primary: "#2979ff",
  8863. primaryDark: "#2b85e4",
  8864. primaryDisabled: "#a0cfff",
  8865. primaryLight: "#ecf5ff",
  8866. bgColor: "#f3f4f6",
  8867. info: "#909399",
  8868. infoDark: "#82848a",
  8869. infoDisabled: "#c8c9cc",
  8870. infoLight: "#f4f4f5",
  8871. warning: "#ff9900",
  8872. warningDark: "#f29100",
  8873. warningDisabled: "#fcbd71",
  8874. warningLight: "#fdf6ec",
  8875. error: "#fa3534",
  8876. errorDark: "#dd6161",
  8877. errorDisabled: "#fab6b6",
  8878. errorLight: "#fef0f0",
  8879. success: "#19be6b",
  8880. successDark: "#18b566",
  8881. successDisabled: "#71d5a1",
  8882. successLight: "#dbf1e1",
  8883. mainColor: "#303133",
  8884. contentColor: "#606266",
  8885. tipsColor: "#909399",
  8886. lightColor: "#c0c4cc",
  8887. borderColor: "#e4e7ed" };var _default =
  8888. color;exports.default = _default;
  8889. /***/ }),
  8890. /* 27 */
  8891. /*!****************************************************************************************!*\
  8892. !*** D:/yin/workspace/uni-app/BLEApp/node_modules/uview-ui/libs/function/type2icon.js ***!
  8893. \****************************************************************************************/
  8894. /*! no static exports found */
  8895. /***/ (function(module, exports, __webpack_require__) {
  8896. "use strict";
  8897. Object.defineProperty(exports, "__esModule", { value: true });exports.default = void 0; /**
  8898. * 根据主题type值,获取对应的图标
  8899. * @param String type 主题名称,primary|info|error|warning|success
  8900. * @param String fill 是否使用fill填充实体的图标
  8901. */
  8902. function type2icon() {var type = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 'success';var fill = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
  8903. // 如果非预置值,默认为success
  8904. if (['primary', 'info', 'error', 'warning', 'success'].indexOf(type) == -1) type = 'success';
  8905. var iconName = '';
  8906. // 目前(2019-12-12),info和primary使用同一个图标
  8907. switch (type) {
  8908. case 'primary':
  8909. iconName = 'info-circle';
  8910. break;
  8911. case 'info':
  8912. iconName = 'info-circle';
  8913. break;
  8914. case 'error':
  8915. iconName = 'close-circle';
  8916. break;
  8917. case 'warning':
  8918. iconName = 'error-circle';
  8919. break;
  8920. case 'success':
  8921. iconName = 'checkmark-circle';
  8922. break;
  8923. default:
  8924. iconName = 'checkmark-circle';}
  8925. // 是否是实体类型,加上-fill,在icon组件库中,实体的类名是后面加-fill的
  8926. if (fill) iconName += '-fill';
  8927. return iconName;
  8928. }var _default =
  8929. type2icon;exports.default = _default;
  8930. /***/ }),
  8931. /* 28 */
  8932. /*!******************************************************************************************!*\
  8933. !*** D:/yin/workspace/uni-app/BLEApp/node_modules/uview-ui/libs/function/randomArray.js ***!
  8934. \******************************************************************************************/
  8935. /*! no static exports found */
  8936. /***/ (function(module, exports, __webpack_require__) {
  8937. "use strict";
  8938. Object.defineProperty(exports, "__esModule", { value: true });exports.default = void 0; // 打乱数组
  8939. function randomArray() {var array = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
  8940. // 原理是sort排序,Math.random()产生0<= x < 1之间的数,会导致x-0.05大于或者小于0
  8941. return array.sort(function () {return Math.random() - 0.5;});
  8942. }var _default =
  8943. randomArray;exports.default = _default;
  8944. /***/ }),
  8945. /* 29 */
  8946. /*!**************************************************************************************!*\
  8947. !*** D:/yin/workspace/uni-app/BLEApp/node_modules/uview-ui/libs/function/addUnit.js ***!
  8948. \**************************************************************************************/
  8949. /*! no static exports found */
  8950. /***/ (function(module, exports, __webpack_require__) {
  8951. "use strict";
  8952. Object.defineProperty(exports, "__esModule", { value: true });exports.default = addUnit;var _test = _interopRequireDefault(__webpack_require__(/*! ./test.js */ 16));function _interopRequireDefault(obj) {return obj && obj.__esModule ? obj : { default: obj };}
  8953. // 添加单位,如果有rpx,%,px等单位结尾或者值为auto,直接返回,否则加上rpx单位结尾
  8954. function addUnit() {var value = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 'auto';var unit = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'rpx';
  8955. value = String(value);
  8956. // 用uView内置验证规则中的number判断是否为数值
  8957. return _test.default.number(value) ? "".concat(value).concat(unit) : value;
  8958. }
  8959. /***/ }),
  8960. /* 30 */
  8961. /*!*************************************************************************************!*\
  8962. !*** D:/yin/workspace/uni-app/BLEApp/node_modules/uview-ui/libs/function/random.js ***!
  8963. \*************************************************************************************/
  8964. /*! no static exports found */
  8965. /***/ (function(module, exports, __webpack_require__) {
  8966. "use strict";
  8967. Object.defineProperty(exports, "__esModule", { value: true });exports.default = void 0;function random(min, max) {
  8968. if (min >= 0 && max > 0 && max >= min) {
  8969. var gab = max - min + 1;
  8970. return Math.floor(Math.random() * gab + min);
  8971. } else {
  8972. return 0;
  8973. }
  8974. }var _default =
  8975. random;exports.default = _default;
  8976. /***/ }),
  8977. /* 31 */
  8978. /*!***********************************************************************************!*\
  8979. !*** D:/yin/workspace/uni-app/BLEApp/node_modules/uview-ui/libs/function/trim.js ***!
  8980. \***********************************************************************************/
  8981. /*! no static exports found */
  8982. /***/ (function(module, exports, __webpack_require__) {
  8983. "use strict";
  8984. Object.defineProperty(exports, "__esModule", { value: true });exports.default = void 0;function trim(str) {var pos = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'both';
  8985. if (pos == 'both') {
  8986. return str.replace(/^\s+|\s+$/g, "");
  8987. } else if (pos == "left") {
  8988. return str.replace(/^\s*/, '');
  8989. } else if (pos == 'right') {
  8990. return str.replace(/(\s*$)/g, "");
  8991. } else if (pos == 'all') {
  8992. return str.replace(/\s+/g, "");
  8993. } else {
  8994. return str;
  8995. }
  8996. }var _default =
  8997. trim;exports.default = _default;
  8998. /***/ }),
  8999. /* 32 */
  9000. /*!************************************************************************************!*\
  9001. !*** D:/yin/workspace/uni-app/BLEApp/node_modules/uview-ui/libs/function/toast.js ***!
  9002. \************************************************************************************/
  9003. /*! no static exports found */
  9004. /***/ (function(module, exports, __webpack_require__) {
  9005. "use strict";
  9006. /* WEBPACK VAR INJECTION */(function(uni) {Object.defineProperty(exports, "__esModule", { value: true });exports.default = void 0;function toast(title) {var duration = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 1500;
  9007. uni.showToast({
  9008. title: title,
  9009. icon: 'none',
  9010. duration: duration });
  9011. }var _default =
  9012. toast;exports.default = _default;
  9013. /* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./node_modules/@dcloudio/uni-mp-weixin/dist/index.js */ 1)["default"]))
  9014. /***/ }),
  9015. /* 33 */
  9016. /*!****************************************************************************************!*\
  9017. !*** D:/yin/workspace/uni-app/BLEApp/node_modules/uview-ui/libs/function/getParent.js ***!
  9018. \****************************************************************************************/
  9019. /*! no static exports found */
  9020. /***/ (function(module, exports, __webpack_require__) {
  9021. "use strict";
  9022. Object.defineProperty(exports, "__esModule", { value: true });exports.default = getParent; // 获取父组件的参数,因为支付宝小程序不支持provide/inject的写法
  9023. // this.$parent在非H5中,可以准确获取到父组件,但是在H5中,需要多次this.$parent.$parent.xxx
  9024. function getParent(name, keys) {
  9025. var parent = this.$parent;
  9026. // 通过while历遍,这里主要是为了H5需要多层解析的问题
  9027. while (parent) {
  9028. // 父组件
  9029. if (parent.$options.name !== name) {
  9030. // 如果组件的name不相等,继续上一级寻找
  9031. parent = parent.$parent;
  9032. } else {var _ret = function () {
  9033. var data = {};
  9034. // 判断keys是否数组,如果传过来的是一个数组,那么直接使用数组元素值当做键值去父组件寻找
  9035. if (Array.isArray(keys)) {
  9036. keys.map(function (val) {
  9037. data[val] = parent[val] ? parent[val] : '';
  9038. });
  9039. } else {
  9040. // 历遍传过来的对象参数
  9041. for (var i in keys) {
  9042. // 如果子组件有此值则用,无此值则用父组件的值
  9043. // 判断是否空数组,如果是,则用父组件的值,否则用子组件的值
  9044. if (Array.isArray(keys[i])) {
  9045. if (keys[i].length) {
  9046. data[i] = keys[i];
  9047. } else {
  9048. data[i] = parent[i];
  9049. }
  9050. } else if (keys[i].constructor === Object) {
  9051. // 判断是否对象,如果是对象,且有属性,那么使用子组件的值,否则使用父组件的值
  9052. if (Object.keys(keys[i]).length) {
  9053. data[i] = keys[i];
  9054. } else {
  9055. data[i] = parent[i];
  9056. }
  9057. } else {
  9058. // 只要子组件有传值,即使是false值,也是“传值”了,也需要覆盖父组件的同名参数
  9059. data[i] = keys[i] || keys[i] === false ? keys[i] : parent[i];
  9060. }
  9061. }
  9062. }
  9063. return { v: data };}();if (typeof _ret === "object") return _ret.v;
  9064. }
  9065. }
  9066. return {};
  9067. }
  9068. /***/ }),
  9069. /* 34 */
  9070. /*!**************************************************************************************!*\
  9071. !*** D:/yin/workspace/uni-app/BLEApp/node_modules/uview-ui/libs/function/$parent.js ***!
  9072. \**************************************************************************************/
  9073. /*! no static exports found */
  9074. /***/ (function(module, exports, __webpack_require__) {
  9075. "use strict";
  9076. Object.defineProperty(exports, "__esModule", { value: true });exports.default = $parent; // 获取父组件的参数,因为支付宝小程序不支持provide/inject的写法
  9077. // this.$parent在非H5中,可以准确获取到父组件,但是在H5中,需要多次this.$parent.$parent.xxx
  9078. // 这里默认值等于undefined有它的含义,因为最顶层元素(组件)的$parent就是undefined,意味着不传name
  9079. // 值(默认为undefined),就是查找最顶层的$parent
  9080. function $parent() {var name = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : undefined;
  9081. var parent = this.$parent;
  9082. // 通过while历遍,这里主要是为了H5需要多层解析的问题
  9083. while (parent) {
  9084. // 父组件
  9085. if (parent.$options && parent.$options.name !== name) {
  9086. // 如果组件的name不相等,继续上一级寻找
  9087. parent = parent.$parent;
  9088. } else {
  9089. return parent;
  9090. }
  9091. }
  9092. return false;
  9093. }
  9094. /***/ }),
  9095. /* 35 */
  9096. /*!**********************************************************************************!*\
  9097. !*** D:/yin/workspace/uni-app/BLEApp/node_modules/uview-ui/libs/function/sys.js ***!
  9098. \**********************************************************************************/
  9099. /*! no static exports found */
  9100. /***/ (function(module, exports, __webpack_require__) {
  9101. "use strict";
  9102. /* WEBPACK VAR INJECTION */(function(uni) {Object.defineProperty(exports, "__esModule", { value: true });exports.os = os;exports.sys = sys;function os() {
  9103. return uni.getSystemInfoSync().platform;
  9104. };
  9105. function sys() {
  9106. return uni.getSystemInfoSync();
  9107. }
  9108. /* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./node_modules/@dcloudio/uni-mp-weixin/dist/index.js */ 1)["default"]))
  9109. /***/ }),
  9110. /* 36 */
  9111. /*!***************************************************************************************!*\
  9112. !*** D:/yin/workspace/uni-app/BLEApp/node_modules/uview-ui/libs/function/debounce.js ***!
  9113. \***************************************************************************************/
  9114. /*! no static exports found */
  9115. /***/ (function(module, exports, __webpack_require__) {
  9116. "use strict";
  9117. Object.defineProperty(exports, "__esModule", { value: true });exports.default = void 0;var timeout = null;
  9118. /**
  9119. * 防抖原理一定时间内只有最后一次操作再过wait毫秒后才执行函数
  9120. *
  9121. * @param {Function} func 要执行的回调函数
  9122. * @param {Number} wait 延时的时间
  9123. * @param {Boolean} immediate 是否立即执行
  9124. * @return null
  9125. */
  9126. function debounce(func) {var wait = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 500;var immediate = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
  9127. // 清除定时器
  9128. if (timeout !== null) clearTimeout(timeout);
  9129. // 立即执行,此类情况一般用不到
  9130. if (immediate) {
  9131. var callNow = !timeout;
  9132. timeout = setTimeout(function () {
  9133. timeout = null;
  9134. }, wait);
  9135. if (callNow) typeof func === 'function' && func();
  9136. } else {
  9137. // 设置定时器,当最后一次操作后,timeout不会再被清除,所以在延时wait毫秒后执行func回调方法
  9138. timeout = setTimeout(function () {
  9139. typeof func === 'function' && func();
  9140. }, wait);
  9141. }
  9142. }var _default =
  9143. debounce;exports.default = _default;
  9144. /***/ }),
  9145. /* 37 */
  9146. /*!***************************************************************************************!*\
  9147. !*** D:/yin/workspace/uni-app/BLEApp/node_modules/uview-ui/libs/function/throttle.js ***!
  9148. \***************************************************************************************/
  9149. /*! no static exports found */
  9150. /***/ (function(module, exports, __webpack_require__) {
  9151. "use strict";
  9152. Object.defineProperty(exports, "__esModule", { value: true });exports.default = void 0;var timer, flag;
  9153. /**
  9154. * 节流原理在一定时间内只能触发一次
  9155. *
  9156. * @param {Function} func 要执行的回调函数
  9157. * @param {Number} wait 延时的时间
  9158. * @param {Boolean} immediate 是否立即执行
  9159. * @return null
  9160. */
  9161. function throttle(func) {var wait = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 500;var immediate = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : true;
  9162. if (immediate) {
  9163. if (!flag) {
  9164. flag = true;
  9165. // 如果是立即执行,则在wait毫秒内开始时执行
  9166. typeof func === 'function' && func();
  9167. timer = setTimeout(function () {
  9168. flag = false;
  9169. }, wait);
  9170. }
  9171. } else {
  9172. if (!flag) {
  9173. flag = true;
  9174. // 如果是非立即执行,则在wait毫秒内的结束处执行
  9175. timer = setTimeout(function () {
  9176. flag = false;
  9177. typeof func === 'function' && func();
  9178. }, wait);
  9179. }
  9180. }
  9181. };var _default =
  9182. throttle;exports.default = _default;
  9183. /***/ }),
  9184. /* 38 */
  9185. /*!***********************************************************************************!*\
  9186. !*** D:/yin/workspace/uni-app/BLEApp/node_modules/uview-ui/libs/config/config.js ***!
  9187. \***********************************************************************************/
  9188. /*! no static exports found */
  9189. /***/ (function(module, exports, __webpack_require__) {
  9190. "use strict";
  9191. Object.defineProperty(exports, "__esModule", { value: true });exports.default = void 0; // 此版本发布于2020-12-17
  9192. var version = '1.8.3';var _default =
  9193. {
  9194. v: version,
  9195. version: version,
  9196. // 主题名称
  9197. type: [
  9198. 'primary',
  9199. 'success',
  9200. 'info',
  9201. 'error',
  9202. 'warning'] };exports.default = _default;
  9203. /***/ }),
  9204. /* 39 */
  9205. /*!***********************************************************************************!*\
  9206. !*** D:/yin/workspace/uni-app/BLEApp/node_modules/uview-ui/libs/config/zIndex.js ***!
  9207. \***********************************************************************************/
  9208. /*! no static exports found */
  9209. /***/ (function(module, exports, __webpack_require__) {
  9210. "use strict";
  9211. Object.defineProperty(exports, "__esModule", { value: true });exports.default = void 0; // uniapp在H5中各API的z-index值如下:
  9212. /**
  9213. * actionsheet: 999
  9214. * modal: 999
  9215. * navigate: 998
  9216. * tabbar: 998
  9217. * toast: 999
  9218. */var _default =
  9219. {
  9220. toast: 10090,
  9221. noNetwork: 10080,
  9222. // popup包含popup,actionsheet,keyboard,picker的值
  9223. popup: 10075,
  9224. mask: 10070,
  9225. navbar: 980,
  9226. topTips: 975,
  9227. sticky: 970,
  9228. indexListSticky: 965 };exports.default = _default;
  9229. /***/ })
  9230. ]]);
  9231. //# sourceMappingURL=../../.sourcemap/mp-weixin/common/vendor.js.map