vue-router-tab.common.js 78 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335
  1. module.exports =
  2. /******/ (function(modules) { // webpackBootstrap
  3. /******/ // The module cache
  4. /******/ var installedModules = {};
  5. /******/
  6. /******/ // The require function
  7. /******/ function __webpack_require__(moduleId) {
  8. /******/
  9. /******/ // Check if module is in cache
  10. /******/ if(installedModules[moduleId]) {
  11. /******/ return installedModules[moduleId].exports;
  12. /******/ }
  13. /******/ // Create a new module (and put it into the cache)
  14. /******/ var module = installedModules[moduleId] = {
  15. /******/ i: moduleId,
  16. /******/ l: false,
  17. /******/ exports: {}
  18. /******/ };
  19. /******/
  20. /******/ // Execute the module function
  21. /******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
  22. /******/
  23. /******/ // Flag the module as loaded
  24. /******/ module.l = true;
  25. /******/
  26. /******/ // Return the exports of the module
  27. /******/ return module.exports;
  28. /******/ }
  29. /******/
  30. /******/
  31. /******/ // expose the modules object (__webpack_modules__)
  32. /******/ __webpack_require__.m = modules;
  33. /******/
  34. /******/ // expose the module cache
  35. /******/ __webpack_require__.c = installedModules;
  36. /******/
  37. /******/ // define getter function for harmony exports
  38. /******/ __webpack_require__.d = function(exports, name, getter) {
  39. /******/ if(!__webpack_require__.o(exports, name)) {
  40. /******/ Object.defineProperty(exports, name, { enumerable: true, get: getter });
  41. /******/ }
  42. /******/ };
  43. /******/
  44. /******/ // define __esModule on exports
  45. /******/ __webpack_require__.r = function(exports) {
  46. /******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
  47. /******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
  48. /******/ }
  49. /******/ Object.defineProperty(exports, '__esModule', { value: true });
  50. /******/ };
  51. /******/
  52. /******/ // create a fake namespace object
  53. /******/ // mode & 1: value is a module id, require it
  54. /******/ // mode & 2: merge all properties of value into the ns
  55. /******/ // mode & 4: return value when already ns object
  56. /******/ // mode & 8|1: behave like require
  57. /******/ __webpack_require__.t = function(value, mode) {
  58. /******/ if(mode & 1) value = __webpack_require__(value);
  59. /******/ if(mode & 8) return value;
  60. /******/ if((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;
  61. /******/ var ns = Object.create(null);
  62. /******/ __webpack_require__.r(ns);
  63. /******/ Object.defineProperty(ns, 'default', { enumerable: true, value: value });
  64. /******/ if(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));
  65. /******/ return ns;
  66. /******/ };
  67. /******/
  68. /******/ // getDefaultExport function for compatibility with non-harmony modules
  69. /******/ __webpack_require__.n = function(module) {
  70. /******/ var getter = module && module.__esModule ?
  71. /******/ function getDefault() { return module['default']; } :
  72. /******/ function getModuleExports() { return module; };
  73. /******/ __webpack_require__.d(getter, 'a', getter);
  74. /******/ return getter;
  75. /******/ };
  76. /******/
  77. /******/ // Object.prototype.hasOwnProperty.call
  78. /******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };
  79. /******/
  80. /******/ // __webpack_public_path__
  81. /******/ __webpack_require__.p = "";
  82. /******/
  83. /******/
  84. /******/ // Load entry module and return exports
  85. /******/ return __webpack_require__(__webpack_require__.s = "fb15");
  86. /******/ })
  87. /************************************************************************/
  88. /******/ ({
  89. /***/ "02eb":
  90. /***/ (function(module, exports, __webpack_require__) {
  91. // extracted by mini-css-extract-plugin
  92. /***/ }),
  93. /***/ "4795":
  94. /***/ (function(module, exports, __webpack_require__) {
  95. module.exports = __webpack_require__("96cf");
  96. /***/ }),
  97. /***/ "4ba7":
  98. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  99. "use strict";
  100. /* harmony import */ var _node_modules_mini_css_extract_plugin_dist_loader_js_ref_8_oneOf_1_0_node_modules_css_loader_index_js_ref_8_oneOf_1_1_node_modules_vue_loader_lib_loaders_stylePostLoader_js_node_modules_postcss_loader_src_index_js_ref_8_oneOf_1_2_node_modules_sass_loader_lib_loader_js_ref_8_oneOf_1_3_transition_scss_vue_type_style_index_1_lang_scss___WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__("02eb");
  101. /* harmony import */ var _node_modules_mini_css_extract_plugin_dist_loader_js_ref_8_oneOf_1_0_node_modules_css_loader_index_js_ref_8_oneOf_1_1_node_modules_vue_loader_lib_loaders_stylePostLoader_js_node_modules_postcss_loader_src_index_js_ref_8_oneOf_1_2_node_modules_sass_loader_lib_loader_js_ref_8_oneOf_1_3_transition_scss_vue_type_style_index_1_lang_scss___WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_node_modules_mini_css_extract_plugin_dist_loader_js_ref_8_oneOf_1_0_node_modules_css_loader_index_js_ref_8_oneOf_1_1_node_modules_vue_loader_lib_loaders_stylePostLoader_js_node_modules_postcss_loader_src_index_js_ref_8_oneOf_1_2_node_modules_sass_loader_lib_loader_js_ref_8_oneOf_1_3_transition_scss_vue_type_style_index_1_lang_scss___WEBPACK_IMPORTED_MODULE_0__);
  102. /* unused harmony reexport * */
  103. /* unused harmony default export */ var _unused_webpack_default_export = (_node_modules_mini_css_extract_plugin_dist_loader_js_ref_8_oneOf_1_0_node_modules_css_loader_index_js_ref_8_oneOf_1_1_node_modules_vue_loader_lib_loaders_stylePostLoader_js_node_modules_postcss_loader_src_index_js_ref_8_oneOf_1_2_node_modules_sass_loader_lib_loader_js_ref_8_oneOf_1_3_transition_scss_vue_type_style_index_1_lang_scss___WEBPACK_IMPORTED_MODULE_0___default.a);
  104. /***/ }),
  105. /***/ "8bbf":
  106. /***/ (function(module, exports) {
  107. module.exports = require("vue");
  108. /***/ }),
  109. /***/ "96cf":
  110. /***/ (function(module, exports, __webpack_require__) {
  111. /**
  112. * Copyright (c) 2014-present, Facebook, Inc.
  113. *
  114. * This source code is licensed under the MIT license found in the
  115. * LICENSE file in the root directory of this source tree.
  116. */
  117. var runtime = (function (exports) {
  118. "use strict";
  119. var Op = Object.prototype;
  120. var hasOwn = Op.hasOwnProperty;
  121. var undefined; // More compressible than void 0.
  122. var $Symbol = typeof Symbol === "function" ? Symbol : {};
  123. var iteratorSymbol = $Symbol.iterator || "@@iterator";
  124. var asyncIteratorSymbol = $Symbol.asyncIterator || "@@asyncIterator";
  125. var toStringTagSymbol = $Symbol.toStringTag || "@@toStringTag";
  126. function wrap(innerFn, outerFn, self, tryLocsList) {
  127. // If outerFn provided and outerFn.prototype is a Generator, then outerFn.prototype instanceof Generator.
  128. var protoGenerator = outerFn && outerFn.prototype instanceof Generator ? outerFn : Generator;
  129. var generator = Object.create(protoGenerator.prototype);
  130. var context = new Context(tryLocsList || []);
  131. // The ._invoke method unifies the implementations of the .next,
  132. // .throw, and .return methods.
  133. generator._invoke = makeInvokeMethod(innerFn, self, context);
  134. return generator;
  135. }
  136. exports.wrap = wrap;
  137. // Try/catch helper to minimize deoptimizations. Returns a completion
  138. // record like context.tryEntries[i].completion. This interface could
  139. // have been (and was previously) designed to take a closure to be
  140. // invoked without arguments, but in all the cases we care about we
  141. // already have an existing method we want to call, so there's no need
  142. // to create a new function object. We can even get away with assuming
  143. // the method takes exactly one argument, since that happens to be true
  144. // in every case, so we don't have to touch the arguments object. The
  145. // only additional allocation required is the completion record, which
  146. // has a stable shape and so hopefully should be cheap to allocate.
  147. function tryCatch(fn, obj, arg) {
  148. try {
  149. return { type: "normal", arg: fn.call(obj, arg) };
  150. } catch (err) {
  151. return { type: "throw", arg: err };
  152. }
  153. }
  154. var GenStateSuspendedStart = "suspendedStart";
  155. var GenStateSuspendedYield = "suspendedYield";
  156. var GenStateExecuting = "executing";
  157. var GenStateCompleted = "completed";
  158. // Returning this object from the innerFn has the same effect as
  159. // breaking out of the dispatch switch statement.
  160. var ContinueSentinel = {};
  161. // Dummy constructor functions that we use as the .constructor and
  162. // .constructor.prototype properties for functions that return Generator
  163. // objects. For full spec compliance, you may wish to configure your
  164. // minifier not to mangle the names of these two functions.
  165. function Generator() {}
  166. function GeneratorFunction() {}
  167. function GeneratorFunctionPrototype() {}
  168. // This is a polyfill for %IteratorPrototype% for environments that
  169. // don't natively support it.
  170. var IteratorPrototype = {};
  171. IteratorPrototype[iteratorSymbol] = function () {
  172. return this;
  173. };
  174. var getProto = Object.getPrototypeOf;
  175. var NativeIteratorPrototype = getProto && getProto(getProto(values([])));
  176. if (NativeIteratorPrototype &&
  177. NativeIteratorPrototype !== Op &&
  178. hasOwn.call(NativeIteratorPrototype, iteratorSymbol)) {
  179. // This environment has a native %IteratorPrototype%; use it instead
  180. // of the polyfill.
  181. IteratorPrototype = NativeIteratorPrototype;
  182. }
  183. var Gp = GeneratorFunctionPrototype.prototype =
  184. Generator.prototype = Object.create(IteratorPrototype);
  185. GeneratorFunction.prototype = Gp.constructor = GeneratorFunctionPrototype;
  186. GeneratorFunctionPrototype.constructor = GeneratorFunction;
  187. GeneratorFunctionPrototype[toStringTagSymbol] =
  188. GeneratorFunction.displayName = "GeneratorFunction";
  189. // Helper for defining the .next, .throw, and .return methods of the
  190. // Iterator interface in terms of a single ._invoke method.
  191. function defineIteratorMethods(prototype) {
  192. ["next", "throw", "return"].forEach(function(method) {
  193. prototype[method] = function(arg) {
  194. return this._invoke(method, arg);
  195. };
  196. });
  197. }
  198. exports.isGeneratorFunction = function(genFun) {
  199. var ctor = typeof genFun === "function" && genFun.constructor;
  200. return ctor
  201. ? ctor === GeneratorFunction ||
  202. // For the native GeneratorFunction constructor, the best we can
  203. // do is to check its .name property.
  204. (ctor.displayName || ctor.name) === "GeneratorFunction"
  205. : false;
  206. };
  207. exports.mark = function(genFun) {
  208. if (Object.setPrototypeOf) {
  209. Object.setPrototypeOf(genFun, GeneratorFunctionPrototype);
  210. } else {
  211. genFun.__proto__ = GeneratorFunctionPrototype;
  212. if (!(toStringTagSymbol in genFun)) {
  213. genFun[toStringTagSymbol] = "GeneratorFunction";
  214. }
  215. }
  216. genFun.prototype = Object.create(Gp);
  217. return genFun;
  218. };
  219. // Within the body of any async function, `await x` is transformed to
  220. // `yield regeneratorRuntime.awrap(x)`, so that the runtime can test
  221. // `hasOwn.call(value, "__await")` to determine if the yielded value is
  222. // meant to be awaited.
  223. exports.awrap = function(arg) {
  224. return { __await: arg };
  225. };
  226. function AsyncIterator(generator) {
  227. function invoke(method, arg, resolve, reject) {
  228. var record = tryCatch(generator[method], generator, arg);
  229. if (record.type === "throw") {
  230. reject(record.arg);
  231. } else {
  232. var result = record.arg;
  233. var value = result.value;
  234. if (value &&
  235. typeof value === "object" &&
  236. hasOwn.call(value, "__await")) {
  237. return Promise.resolve(value.__await).then(function(value) {
  238. invoke("next", value, resolve, reject);
  239. }, function(err) {
  240. invoke("throw", err, resolve, reject);
  241. });
  242. }
  243. return Promise.resolve(value).then(function(unwrapped) {
  244. // When a yielded Promise is resolved, its final value becomes
  245. // the .value of the Promise<{value,done}> result for the
  246. // current iteration.
  247. result.value = unwrapped;
  248. resolve(result);
  249. }, function(error) {
  250. // If a rejected Promise was yielded, throw the rejection back
  251. // into the async generator function so it can be handled there.
  252. return invoke("throw", error, resolve, reject);
  253. });
  254. }
  255. }
  256. var previousPromise;
  257. function enqueue(method, arg) {
  258. function callInvokeWithMethodAndArg() {
  259. return new Promise(function(resolve, reject) {
  260. invoke(method, arg, resolve, reject);
  261. });
  262. }
  263. return previousPromise =
  264. // If enqueue has been called before, then we want to wait until
  265. // all previous Promises have been resolved before calling invoke,
  266. // so that results are always delivered in the correct order. If
  267. // enqueue has not been called before, then it is important to
  268. // call invoke immediately, without waiting on a callback to fire,
  269. // so that the async generator function has the opportunity to do
  270. // any necessary setup in a predictable way. This predictability
  271. // is why the Promise constructor synchronously invokes its
  272. // executor callback, and why async functions synchronously
  273. // execute code before the first await. Since we implement simple
  274. // async functions in terms of async generators, it is especially
  275. // important to get this right, even though it requires care.
  276. previousPromise ? previousPromise.then(
  277. callInvokeWithMethodAndArg,
  278. // Avoid propagating failures to Promises returned by later
  279. // invocations of the iterator.
  280. callInvokeWithMethodAndArg
  281. ) : callInvokeWithMethodAndArg();
  282. }
  283. // Define the unified helper method that is used to implement .next,
  284. // .throw, and .return (see defineIteratorMethods).
  285. this._invoke = enqueue;
  286. }
  287. defineIteratorMethods(AsyncIterator.prototype);
  288. AsyncIterator.prototype[asyncIteratorSymbol] = function () {
  289. return this;
  290. };
  291. exports.AsyncIterator = AsyncIterator;
  292. // Note that simple async functions are implemented on top of
  293. // AsyncIterator objects; they just return a Promise for the value of
  294. // the final result produced by the iterator.
  295. exports.async = function(innerFn, outerFn, self, tryLocsList) {
  296. var iter = new AsyncIterator(
  297. wrap(innerFn, outerFn, self, tryLocsList)
  298. );
  299. return exports.isGeneratorFunction(outerFn)
  300. ? iter // If outerFn is a generator, return the full iterator.
  301. : iter.next().then(function(result) {
  302. return result.done ? result.value : iter.next();
  303. });
  304. };
  305. function makeInvokeMethod(innerFn, self, context) {
  306. var state = GenStateSuspendedStart;
  307. return function invoke(method, arg) {
  308. if (state === GenStateExecuting) {
  309. throw new Error("Generator is already running");
  310. }
  311. if (state === GenStateCompleted) {
  312. if (method === "throw") {
  313. throw arg;
  314. }
  315. // Be forgiving, per 25.3.3.3.3 of the spec:
  316. // https://people.mozilla.org/~jorendorff/es6-draft.html#sec-generatorresume
  317. return doneResult();
  318. }
  319. context.method = method;
  320. context.arg = arg;
  321. while (true) {
  322. var delegate = context.delegate;
  323. if (delegate) {
  324. var delegateResult = maybeInvokeDelegate(delegate, context);
  325. if (delegateResult) {
  326. if (delegateResult === ContinueSentinel) continue;
  327. return delegateResult;
  328. }
  329. }
  330. if (context.method === "next") {
  331. // Setting context._sent for legacy support of Babel's
  332. // function.sent implementation.
  333. context.sent = context._sent = context.arg;
  334. } else if (context.method === "throw") {
  335. if (state === GenStateSuspendedStart) {
  336. state = GenStateCompleted;
  337. throw context.arg;
  338. }
  339. context.dispatchException(context.arg);
  340. } else if (context.method === "return") {
  341. context.abrupt("return", context.arg);
  342. }
  343. state = GenStateExecuting;
  344. var record = tryCatch(innerFn, self, context);
  345. if (record.type === "normal") {
  346. // If an exception is thrown from innerFn, we leave state ===
  347. // GenStateExecuting and loop back for another invocation.
  348. state = context.done
  349. ? GenStateCompleted
  350. : GenStateSuspendedYield;
  351. if (record.arg === ContinueSentinel) {
  352. continue;
  353. }
  354. return {
  355. value: record.arg,
  356. done: context.done
  357. };
  358. } else if (record.type === "throw") {
  359. state = GenStateCompleted;
  360. // Dispatch the exception by looping back around to the
  361. // context.dispatchException(context.arg) call above.
  362. context.method = "throw";
  363. context.arg = record.arg;
  364. }
  365. }
  366. };
  367. }
  368. // Call delegate.iterator[context.method](context.arg) and handle the
  369. // result, either by returning a { value, done } result from the
  370. // delegate iterator, or by modifying context.method and context.arg,
  371. // setting context.delegate to null, and returning the ContinueSentinel.
  372. function maybeInvokeDelegate(delegate, context) {
  373. var method = delegate.iterator[context.method];
  374. if (method === undefined) {
  375. // A .throw or .return when the delegate iterator has no .throw
  376. // method always terminates the yield* loop.
  377. context.delegate = null;
  378. if (context.method === "throw") {
  379. // Note: ["return"] must be used for ES3 parsing compatibility.
  380. if (delegate.iterator["return"]) {
  381. // If the delegate iterator has a return method, give it a
  382. // chance to clean up.
  383. context.method = "return";
  384. context.arg = undefined;
  385. maybeInvokeDelegate(delegate, context);
  386. if (context.method === "throw") {
  387. // If maybeInvokeDelegate(context) changed context.method from
  388. // "return" to "throw", let that override the TypeError below.
  389. return ContinueSentinel;
  390. }
  391. }
  392. context.method = "throw";
  393. context.arg = new TypeError(
  394. "The iterator does not provide a 'throw' method");
  395. }
  396. return ContinueSentinel;
  397. }
  398. var record = tryCatch(method, delegate.iterator, context.arg);
  399. if (record.type === "throw") {
  400. context.method = "throw";
  401. context.arg = record.arg;
  402. context.delegate = null;
  403. return ContinueSentinel;
  404. }
  405. var info = record.arg;
  406. if (! info) {
  407. context.method = "throw";
  408. context.arg = new TypeError("iterator result is not an object");
  409. context.delegate = null;
  410. return ContinueSentinel;
  411. }
  412. if (info.done) {
  413. // Assign the result of the finished delegate to the temporary
  414. // variable specified by delegate.resultName (see delegateYield).
  415. context[delegate.resultName] = info.value;
  416. // Resume execution at the desired location (see delegateYield).
  417. context.next = delegate.nextLoc;
  418. // If context.method was "throw" but the delegate handled the
  419. // exception, let the outer generator proceed normally. If
  420. // context.method was "next", forget context.arg since it has been
  421. // "consumed" by the delegate iterator. If context.method was
  422. // "return", allow the original .return call to continue in the
  423. // outer generator.
  424. if (context.method !== "return") {
  425. context.method = "next";
  426. context.arg = undefined;
  427. }
  428. } else {
  429. // Re-yield the result returned by the delegate method.
  430. return info;
  431. }
  432. // The delegate iterator is finished, so forget it and continue with
  433. // the outer generator.
  434. context.delegate = null;
  435. return ContinueSentinel;
  436. }
  437. // Define Generator.prototype.{next,throw,return} in terms of the
  438. // unified ._invoke helper method.
  439. defineIteratorMethods(Gp);
  440. Gp[toStringTagSymbol] = "Generator";
  441. // A Generator should always return itself as the iterator object when the
  442. // @@iterator function is called on it. Some browsers' implementations of the
  443. // iterator prototype chain incorrectly implement this, causing the Generator
  444. // object to not be returned from this call. This ensures that doesn't happen.
  445. // See https://github.com/facebook/regenerator/issues/274 for more details.
  446. Gp[iteratorSymbol] = function() {
  447. return this;
  448. };
  449. Gp.toString = function() {
  450. return "[object Generator]";
  451. };
  452. function pushTryEntry(locs) {
  453. var entry = { tryLoc: locs[0] };
  454. if (1 in locs) {
  455. entry.catchLoc = locs[1];
  456. }
  457. if (2 in locs) {
  458. entry.finallyLoc = locs[2];
  459. entry.afterLoc = locs[3];
  460. }
  461. this.tryEntries.push(entry);
  462. }
  463. function resetTryEntry(entry) {
  464. var record = entry.completion || {};
  465. record.type = "normal";
  466. delete record.arg;
  467. entry.completion = record;
  468. }
  469. function Context(tryLocsList) {
  470. // The root entry object (effectively a try statement without a catch
  471. // or a finally block) gives us a place to store values thrown from
  472. // locations where there is no enclosing try statement.
  473. this.tryEntries = [{ tryLoc: "root" }];
  474. tryLocsList.forEach(pushTryEntry, this);
  475. this.reset(true);
  476. }
  477. exports.keys = function(object) {
  478. var keys = [];
  479. for (var key in object) {
  480. keys.push(key);
  481. }
  482. keys.reverse();
  483. // Rather than returning an object with a next method, we keep
  484. // things simple and return the next function itself.
  485. return function next() {
  486. while (keys.length) {
  487. var key = keys.pop();
  488. if (key in object) {
  489. next.value = key;
  490. next.done = false;
  491. return next;
  492. }
  493. }
  494. // To avoid creating an additional object, we just hang the .value
  495. // and .done properties off the next function object itself. This
  496. // also ensures that the minifier will not anonymize the function.
  497. next.done = true;
  498. return next;
  499. };
  500. };
  501. function values(iterable) {
  502. if (iterable) {
  503. var iteratorMethod = iterable[iteratorSymbol];
  504. if (iteratorMethod) {
  505. return iteratorMethod.call(iterable);
  506. }
  507. if (typeof iterable.next === "function") {
  508. return iterable;
  509. }
  510. if (!isNaN(iterable.length)) {
  511. var i = -1, next = function next() {
  512. while (++i < iterable.length) {
  513. if (hasOwn.call(iterable, i)) {
  514. next.value = iterable[i];
  515. next.done = false;
  516. return next;
  517. }
  518. }
  519. next.value = undefined;
  520. next.done = true;
  521. return next;
  522. };
  523. return next.next = next;
  524. }
  525. }
  526. // Return an iterator with no values.
  527. return { next: doneResult };
  528. }
  529. exports.values = values;
  530. function doneResult() {
  531. return { value: undefined, done: true };
  532. }
  533. Context.prototype = {
  534. constructor: Context,
  535. reset: function(skipTempReset) {
  536. this.prev = 0;
  537. this.next = 0;
  538. // Resetting context._sent for legacy support of Babel's
  539. // function.sent implementation.
  540. this.sent = this._sent = undefined;
  541. this.done = false;
  542. this.delegate = null;
  543. this.method = "next";
  544. this.arg = undefined;
  545. this.tryEntries.forEach(resetTryEntry);
  546. if (!skipTempReset) {
  547. for (var name in this) {
  548. // Not sure about the optimal order of these conditions:
  549. if (name.charAt(0) === "t" &&
  550. hasOwn.call(this, name) &&
  551. !isNaN(+name.slice(1))) {
  552. this[name] = undefined;
  553. }
  554. }
  555. }
  556. },
  557. stop: function() {
  558. this.done = true;
  559. var rootEntry = this.tryEntries[0];
  560. var rootRecord = rootEntry.completion;
  561. if (rootRecord.type === "throw") {
  562. throw rootRecord.arg;
  563. }
  564. return this.rval;
  565. },
  566. dispatchException: function(exception) {
  567. if (this.done) {
  568. throw exception;
  569. }
  570. var context = this;
  571. function handle(loc, caught) {
  572. record.type = "throw";
  573. record.arg = exception;
  574. context.next = loc;
  575. if (caught) {
  576. // If the dispatched exception was caught by a catch block,
  577. // then let that catch block handle the exception normally.
  578. context.method = "next";
  579. context.arg = undefined;
  580. }
  581. return !! caught;
  582. }
  583. for (var i = this.tryEntries.length - 1; i >= 0; --i) {
  584. var entry = this.tryEntries[i];
  585. var record = entry.completion;
  586. if (entry.tryLoc === "root") {
  587. // Exception thrown outside of any try block that could handle
  588. // it, so set the completion value of the entire function to
  589. // throw the exception.
  590. return handle("end");
  591. }
  592. if (entry.tryLoc <= this.prev) {
  593. var hasCatch = hasOwn.call(entry, "catchLoc");
  594. var hasFinally = hasOwn.call(entry, "finallyLoc");
  595. if (hasCatch && hasFinally) {
  596. if (this.prev < entry.catchLoc) {
  597. return handle(entry.catchLoc, true);
  598. } else if (this.prev < entry.finallyLoc) {
  599. return handle(entry.finallyLoc);
  600. }
  601. } else if (hasCatch) {
  602. if (this.prev < entry.catchLoc) {
  603. return handle(entry.catchLoc, true);
  604. }
  605. } else if (hasFinally) {
  606. if (this.prev < entry.finallyLoc) {
  607. return handle(entry.finallyLoc);
  608. }
  609. } else {
  610. throw new Error("try statement without catch or finally");
  611. }
  612. }
  613. }
  614. },
  615. abrupt: function(type, arg) {
  616. for (var i = this.tryEntries.length - 1; i >= 0; --i) {
  617. var entry = this.tryEntries[i];
  618. if (entry.tryLoc <= this.prev &&
  619. hasOwn.call(entry, "finallyLoc") &&
  620. this.prev < entry.finallyLoc) {
  621. var finallyEntry = entry;
  622. break;
  623. }
  624. }
  625. if (finallyEntry &&
  626. (type === "break" ||
  627. type === "continue") &&
  628. finallyEntry.tryLoc <= arg &&
  629. arg <= finallyEntry.finallyLoc) {
  630. // Ignore the finally entry if control is not jumping to a
  631. // location outside the try/catch block.
  632. finallyEntry = null;
  633. }
  634. var record = finallyEntry ? finallyEntry.completion : {};
  635. record.type = type;
  636. record.arg = arg;
  637. if (finallyEntry) {
  638. this.method = "next";
  639. this.next = finallyEntry.finallyLoc;
  640. return ContinueSentinel;
  641. }
  642. return this.complete(record);
  643. },
  644. complete: function(record, afterLoc) {
  645. if (record.type === "throw") {
  646. throw record.arg;
  647. }
  648. if (record.type === "break" ||
  649. record.type === "continue") {
  650. this.next = record.arg;
  651. } else if (record.type === "return") {
  652. this.rval = this.arg = record.arg;
  653. this.method = "return";
  654. this.next = "end";
  655. } else if (record.type === "normal" && afterLoc) {
  656. this.next = afterLoc;
  657. }
  658. return ContinueSentinel;
  659. },
  660. finish: function(finallyLoc) {
  661. for (var i = this.tryEntries.length - 1; i >= 0; --i) {
  662. var entry = this.tryEntries[i];
  663. if (entry.finallyLoc === finallyLoc) {
  664. this.complete(entry.completion, entry.afterLoc);
  665. resetTryEntry(entry);
  666. return ContinueSentinel;
  667. }
  668. }
  669. },
  670. "catch": function(tryLoc) {
  671. for (var i = this.tryEntries.length - 1; i >= 0; --i) {
  672. var entry = this.tryEntries[i];
  673. if (entry.tryLoc === tryLoc) {
  674. var record = entry.completion;
  675. if (record.type === "throw") {
  676. var thrown = record.arg;
  677. resetTryEntry(entry);
  678. }
  679. return thrown;
  680. }
  681. }
  682. // The context.catch method must only be called with a location
  683. // argument that corresponds to a known catch block.
  684. throw new Error("illegal catch attempt");
  685. },
  686. delegateYield: function(iterable, resultName, nextLoc) {
  687. this.delegate = {
  688. iterator: values(iterable),
  689. resultName: resultName,
  690. nextLoc: nextLoc
  691. };
  692. if (this.method === "next") {
  693. // Deliberately forget the last sent value so that we don't
  694. // accidentally pass it on to the delegate.
  695. this.arg = undefined;
  696. }
  697. return ContinueSentinel;
  698. }
  699. };
  700. // Regardless of whether this script is executing as a CommonJS module
  701. // or not, return the runtime object so that we can declare the variable
  702. // regeneratorRuntime in the outer scope, which allows this module to be
  703. // injected easily by `bin/regenerator --include-runtime script.js`.
  704. return exports;
  705. }(
  706. // If this script is executing as a CommonJS module, use module.exports
  707. // as the regeneratorRuntime namespace. Otherwise create a new empty
  708. // object. Either way, the resulting object will be used to initialize
  709. // the regeneratorRuntime variable at the top of this file.
  710. true ? module.exports : undefined
  711. ));
  712. try {
  713. regeneratorRuntime = runtime;
  714. } catch (accidentalStrictMode) {
  715. // This module should not be running in strict mode, so the above
  716. // assignment should always work unless something is misconfigured. Just
  717. // in case runtime.js accidentally runs in strict mode, we can escape
  718. // strict mode using a global Function call. This could conceivably fail
  719. // if a Content Security Policy forbids using Function, but in that case
  720. // the proper solution is to fix the accidental strict mode problem. If
  721. // you've misconfigured your bundler to force strict mode and applied a
  722. // CSP to forbid Function, and you're not willing to fix either of those
  723. // problems, please detail your unique predicament in a GitHub issue.
  724. Function("r", "regeneratorRuntime = r")(runtime);
  725. }
  726. /***/ }),
  727. /***/ "e42d":
  728. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  729. "use strict";
  730. /* harmony import */ var _node_modules_mini_css_extract_plugin_dist_loader_js_ref_8_oneOf_1_0_node_modules_css_loader_index_js_ref_8_oneOf_1_1_node_modules_vue_loader_lib_loaders_stylePostLoader_js_node_modules_postcss_loader_src_index_js_ref_8_oneOf_1_2_node_modules_sass_loader_lib_loader_js_ref_8_oneOf_1_3_routerTab_scss_vue_type_style_index_0_lang_scss___WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__("f42e");
  731. /* harmony import */ var _node_modules_mini_css_extract_plugin_dist_loader_js_ref_8_oneOf_1_0_node_modules_css_loader_index_js_ref_8_oneOf_1_1_node_modules_vue_loader_lib_loaders_stylePostLoader_js_node_modules_postcss_loader_src_index_js_ref_8_oneOf_1_2_node_modules_sass_loader_lib_loader_js_ref_8_oneOf_1_3_routerTab_scss_vue_type_style_index_0_lang_scss___WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_node_modules_mini_css_extract_plugin_dist_loader_js_ref_8_oneOf_1_0_node_modules_css_loader_index_js_ref_8_oneOf_1_1_node_modules_vue_loader_lib_loaders_stylePostLoader_js_node_modules_postcss_loader_src_index_js_ref_8_oneOf_1_2_node_modules_sass_loader_lib_loader_js_ref_8_oneOf_1_3_routerTab_scss_vue_type_style_index_0_lang_scss___WEBPACK_IMPORTED_MODULE_0__);
  732. /* unused harmony reexport * */
  733. /* unused harmony default export */ var _unused_webpack_default_export = (_node_modules_mini_css_extract_plugin_dist_loader_js_ref_8_oneOf_1_0_node_modules_css_loader_index_js_ref_8_oneOf_1_1_node_modules_vue_loader_lib_loaders_stylePostLoader_js_node_modules_postcss_loader_src_index_js_ref_8_oneOf_1_2_node_modules_sass_loader_lib_loader_js_ref_8_oneOf_1_3_routerTab_scss_vue_type_style_index_0_lang_scss___WEBPACK_IMPORTED_MODULE_0___default.a);
  734. /***/ }),
  735. /***/ "f42e":
  736. /***/ (function(module, exports, __webpack_require__) {
  737. // extracted by mini-css-extract-plugin
  738. /***/ }),
  739. /***/ "fb15":
  740. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  741. "use strict";
  742. __webpack_require__.r(__webpack_exports__);
  743. // CONCATENATED MODULE: ./node_modules/@vue/cli-service/lib/commands/build/setPublicPath.js
  744. // This file is imported into lib/wc client bundles.
  745. if (typeof window !== 'undefined') {
  746. var setPublicPath_i
  747. if ((setPublicPath_i = window.document.currentScript) && (setPublicPath_i = setPublicPath_i.src.match(/(.+\/)[^/]+\.js(\?.*)?$/))) {
  748. __webpack_require__.p = setPublicPath_i[1] // eslint-disable-line
  749. }
  750. }
  751. // Indicate to webpack that this file can be concatenated
  752. /* harmony default export */ var setPublicPath = (null);
  753. // CONCATENATED MODULE: ./node_modules/cache-loader/dist/cjs.js?{"cacheDirectory":"node_modules/.cache/vue-loader","cacheIdentifier":"33e18d7e-vue-loader-template"}!./node_modules/vue-loader/lib/loaders/templateLoader.js??vue-loader-options!./node_modules/cache-loader/dist/cjs.js??ref--0-0!./node_modules/vue-loader/lib??vue-loader-options!./src/components/RouterTab.vue?vue&type=template&id=053ff978&
  754. var RouterTabvue_type_template_id_053ff978_render = function () {var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;return _c('div',{staticClass:"router-tab"},[_c('header',{staticClass:"router-tab-header"},[_c('div',{staticClass:"router-tab-scroll"},[_c('transition-group',_vm._b({staticClass:"router-tab-nav",attrs:{"tag":"ul"},on:{"after-enter":_vm.onTabTransitionEnd,"after-leave":_vm.onTabTransitionEnd}},'transition-group',typeof _vm.tabTransition === 'string' ? { name: _vm.tabTransition } : _vm.tabTransition,false),_vm._l((_vm.items),function(ref,index){
  755. var id = ref.id;
  756. var to = ref.to;
  757. var title = ref.title;
  758. var icon = ref.icon;
  759. var tips = ref.tips;
  760. var closable = ref.closable;
  761. return _c('router-link',{key:id || to,staticClass:"router-tab-item",class:{ actived: _vm.activedTab === id, contextmenu: _vm.contextmenu.id === id },attrs:{"tag":"li","title":tips || title || '',"to":to},nativeOn:{"contextmenu":function($event){$event.preventDefault();return (function (e) { return _vm.showContextmenu(id, index, e); })($event)}}},[_vm._t("default",[(icon)?_c('i',{staticClass:"tab-icon",class:icon}):_vm._e(),_c('span',{staticClass:"tab-title"},[_vm._v(_vm._s(title || _vm.lang.tab.untitled))]),(closable !== false && _vm.items.length > 1)?_c('i',{staticClass:"tab-close",attrs:{"title":_vm.lang.contextmenu.close},on:{"click":function($event){$event.preventDefault();return _vm.closeTab(id)}}}):_vm._e()],null,{
  762. tab: _vm.items[index],
  763. tabs: _vm.items,
  764. index: index
  765. })],2)}),1)],1),_c('a',{staticClass:"el-icon-caret-left nav-prev",on:{"click":function($event){return _vm.tabScroll('left')}}}),_c('a',{staticClass:"el-icon-caret-right nav-next",on:{"click":function($event){return _vm.tabScroll('right')}}})]),_c('div',{staticClass:"router-tab-container",class:{ loading: _vm.loading }},[_c('router-alive',{ref:"routerAlive",attrs:{"alive-id":_vm.aliveId},on:{"update":_vm.updateTab}},[_c('transition',_vm._b({attrs:{"appear":""},on:{"after-enter":_vm.onPageTransitionEnd,"after-leave":_vm.onPageTransitionEnd}},'transition',typeof _vm.pageTransition === 'string' ? { name: _vm.pageTransition } : _vm.pageTransition,false),[(_vm.isRouterAlive)?_c('router-view',_vm._b({ref:"routerView",staticClass:"router-tab-page"},'router-view',_vm.routerView,false)):_vm._e()],1)],1),_c('transition-group',_vm._b({staticClass:"router-tab-iframes",attrs:{"tag":"div"}},'transition-group',typeof _vm.pageTransition === 'string' ? { name: _vm.pageTransition } : _vm.pageTransition,false),_vm._l((_vm.iframes),function(url){return _c('iframe',{directives:[{name:"show",rawName:"v-show",value:(url === _vm.currentIframe),expression:"url === currentIframe"}],key:url,staticClass:"router-tab-iframe",attrs:{"src":url,"frameborder":"0"}})}),0)],1),_c('transition',{attrs:{"name":"router-tab-zoom"}},[(_vm.contextmenu.id)?_c('div',{staticClass:"router-tab-contextmenu",style:(("left: " + (_vm.contextmenu.left) + "px; top: " + (_vm.contextmenu.top) + "px;"))},[_c('a',{staticClass:"contextmenu-item",attrs:{"disabled":!_vm.isContextTabActived},on:{"click":function($event){_vm.isContextTabActived && _vm.refreshTab(_vm.contextmenu.id)}}},[_vm._v("\n "+_vm._s(_vm.lang.contextmenu.refresh)+"\n ")]),_c('a',{staticClass:"contextmenu-item",attrs:{"disabled":_vm.items.length < 2},on:{"click":function($event){_vm.items.length > 1 && _vm.refreshAll()}}},[_vm._v("\n "+_vm._s(_vm.lang.contextmenu.refreshAll)+"\n ")]),_c('a',{staticClass:"contextmenu-item",attrs:{"disabled":!_vm.isContextTabCanBeClosed},on:{"click":function($event){_vm.isContextTabCanBeClosed && _vm.closeTab(_vm.contextmenu.id)}}},[_vm._v("\n "+_vm._s(_vm.lang.contextmenu.close)+"\n ")]),_c('a',{staticClass:"contextmenu-item",attrs:{"disabled":!_vm.tabsLeft.length},on:{"click":function($event){_vm.tabsLeft.length && _vm.closeMulti(_vm.tabsLeft)}}},[_vm._v("\n "+_vm._s(_vm.lang.contextmenu.closeLefts)+"\n ")]),_c('a',{staticClass:"contextmenu-item",attrs:{"disabled":!_vm.tabsRight.length},on:{"click":function($event){_vm.tabsRight.length && _vm.closeMulti(_vm.tabsRight)}}},[_vm._v("\n "+_vm._s(_vm.lang.contextmenu.closeRights)+"\n ")]),_c('a',{staticClass:"contextmenu-item",attrs:{"disabled":!_vm.tabsOther.length},on:{"click":function($event){_vm.tabsOther.length && _vm.closeMulti(_vm.tabsOther)}}},[_vm._v("\n "+_vm._s(_vm.lang.contextmenu.closeOthers)+"\n ")])]):_vm._e()])],1)}
  766. var staticRenderFns = []
  767. // CONCATENATED MODULE: ./src/components/RouterTab.vue?vue&type=template&id=053ff978&
  768. // EXTERNAL MODULE: ./node_modules/@vue/babel-preset-app/node_modules/@babel/runtime/regenerator/index.js
  769. var regenerator = __webpack_require__("4795");
  770. var regenerator_default = /*#__PURE__*/__webpack_require__.n(regenerator);
  771. // EXTERNAL MODULE: external {"commonjs":"vue","commonjs2":"vue","root":"Vue"}
  772. var external_commonjs_vue_commonjs2_vue_root_Vue_ = __webpack_require__("8bbf");
  773. var external_commonjs_vue_commonjs2_vue_root_Vue_default = /*#__PURE__*/__webpack_require__.n(external_commonjs_vue_commonjs2_vue_root_Vue_);
  774. // CONCATENATED MODULE: ./src/util/index.js
  775. // 空对象和数组
  776. var emptyObj = Object.create(null);
  777. var emptyArray = []; // 是否定义
  778. function isDef(v) {
  779. return v !== undefined && v !== null;
  780. } // 防抖
  781. function debounce(fn) {
  782. var delay = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 200;
  783. var timeout = null;
  784. return function () {
  785. var context = this;
  786. var args = arguments;
  787. clearTimeout(timeout);
  788. timeout = setTimeout(function () {
  789. fn.call(context, args);
  790. }, delay);
  791. };
  792. }
  793. // CONCATENATED MODULE: ./src/util/rules.js
  794. // 页签规则
  795. /* harmony default export */ var rules = ({
  796. // 地址,例如:"/page/1?type=a#title" 则取 "/page/1"
  797. path: function path(route) {
  798. return route.path;
  799. },
  800. // 完整地址 (忽略hash),例如:"/page/1?type=a#title" 则取 "/page/1?type=a"
  801. fullpath: function fullpath(route) {
  802. return route.fullPath.replace(route.hash, '');
  803. }
  804. });
  805. // CONCATENATED MODULE: ./src/util/alive.js
  806. // 获取缓存 id
  807. function getAliveId() {
  808. var route = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : this.$route;
  809. var rule = route.meta && route.meta.aliveId || this.aliveId;
  810. if (typeof rule === 'string') {
  811. rule = rules[rule.toLowerCase()];
  812. }
  813. if (typeof rule !== 'function') {
  814. rule = rules.path;
  815. }
  816. return rule.bind(this)(route);
  817. }
  818. // CONCATENATED MODULE: ./src/util/dom.js
  819. // 滚动
  820. function scrollTo($el) {
  821. var left = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
  822. var top = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 0;
  823. if ($el.scrollTo) {
  824. $el.scrollTo({
  825. left: left,
  826. top: top,
  827. behavior: 'smooth'
  828. });
  829. } else {
  830. $el.scrollLeft = left;
  831. $el.scrollTop = top;
  832. }
  833. } // 获取第一个子组件
  834. function getFirstComponentChild(children) {
  835. if (Array.isArray(children)) {
  836. for (var i = 0; i < children.length; i++) {
  837. var c = children[i];
  838. if (isDef(c) && (isDef(c.componentOptions) || isAsyncPlaceholder(c))) {
  839. return c;
  840. }
  841. }
  842. }
  843. } // 是否异步占位
  844. function isAsyncPlaceholder(node) {
  845. return node.isComment && node.asyncFactory;
  846. }
  847. // CONCATENATED MODULE: ./src/util/route.js
  848. // 获取路由不带hash的路径
  849. function getPathWithoutHash(route) {
  850. return route.hash ? route.fullPath.replace(route.hash, '') : route.fullPath;
  851. } // 是否相似路由
  852. function isAlikeRoute(route1, route2) {
  853. return getPathWithoutHash(route1) === getPathWithoutHash(route2);
  854. } // 获取路由页面组件
  855. function getRouteComponent(_ref) {
  856. var matched = _ref.matched;
  857. return matched[matched.length - 1].components.default;
  858. } // 路由是否共用组件
  859. function isSameComponentRoute(route1, route2) {
  860. return getRouteComponent(route1) === getRouteComponent(route2);
  861. }
  862. // CONCATENATED MODULE: ./src/lang/zh-CN.js
  863. /* harmony default export */ var zh_CN = ({
  864. tab: {
  865. untitled: '无标题'
  866. },
  867. contextmenu: {
  868. refresh: '刷新',
  869. refreshAll: '刷新所有',
  870. close: '关闭',
  871. closeLefts: '关闭左侧',
  872. closeRights: '关闭右侧',
  873. closeOthers: '关闭其他'
  874. },
  875. msg: {
  876. keepOneTab: '至少应保留1个页签'
  877. }
  878. });
  879. // CONCATENATED MODULE: ./src/lang/en.js
  880. /* harmony default export */ var en = ({
  881. tab: {
  882. untitled: 'Untitled'
  883. },
  884. contextmenu: {
  885. refresh: 'Refresh',
  886. refreshAll: 'Refresh All',
  887. close: 'Close',
  888. closeLefts: 'Close to the Left',
  889. closeRights: 'Close to the Right',
  890. closeOthers: 'Close Others'
  891. },
  892. msg: {
  893. keepOneTab: 'Keep at least 1 tab'
  894. }
  895. });
  896. // CONCATENATED MODULE: ./src/lang/index.js
  897. /* harmony default export */ var src_lang = ({
  898. 'zh-CN': zh_CN,
  899. en: en
  900. });
  901. // CONCATENATED MODULE: ./src/components/RouterAlive.js
  902. /* harmony default export */ var RouterAlive = ({
  903. name: 'RouterAlive',
  904. props: {
  905. // 缓存id,如果为函数,则参数为route
  906. aliveId: {
  907. type: [String, Function],
  908. default: 'path'
  909. }
  910. },
  911. beforeCreate: function beforeCreate() {
  912. Object.assign(this, {
  913. cache: Object.create(null),
  914. lastRoute: this.$route
  915. });
  916. },
  917. render: function render() {
  918. var slot = this.$slots.default;
  919. var vnode = getFirstComponentChild(slot);
  920. var vmOpts = vnode && vnode.componentOptions;
  921. if (vmOpts) {
  922. var cache = this.cache,
  923. $route = this.$route,
  924. lastRoute = this.lastRoute; // 如果是transition组件,页面组件则为子元素
  925. var pageNode = vmOpts.tag === 'transition' ? vmOpts.children[0] : vnode;
  926. if (pageNode && pageNode.componentOptions) {
  927. // 获取缓存
  928. var key = this.getAliveId();
  929. var cacheItem = cache[key];
  930. var _ref = cacheItem || emptyObj,
  931. cacheVm = _ref.vm,
  932. cacheRoute = _ref.route; // 是否需要重载路由强制刷新页面组件
  933. var needReloadRouter = false; // 路由是否改变
  934. var isRouteChange = lastRoute !== $route; // 是否跟上次路由共用组件
  935. var isSameComponent = isRouteChange && isSameComponentRoute($route, lastRoute);
  936. if (isRouteChange) {
  937. // 更新上次路由
  938. this.lastRoute = $route; // 添加缓存
  939. if (!cacheItem) this.set(key, {
  940. route: $route
  941. });
  942. }
  943. if (cacheVm) {
  944. // 缓存组件的路由地址除hash外一致则取缓存的组件
  945. if (isAlikeRoute(cacheRoute, $route)) {
  946. pageNode.componentInstance = cacheVm;
  947. } else {
  948. // 缓存组件路由地址不匹配则销毁缓存并重载路由
  949. cacheVm.$destroy();
  950. cacheItem.vm = null;
  951. needReloadRouter = true;
  952. }
  953. } // 路由改变后但组件相同需重载路由
  954. if (isSameComponent) needReloadRouter = true; // 重载路由以强制更新页面
  955. needReloadRouter && this.$routerTab.reloadRouter(); // 标记为keepAlive和routerAlive
  956. pageNode.data.keepAlive = true;
  957. pageNode.data.routerAlive = this;
  958. }
  959. }
  960. return vnode || slot && slot[0];
  961. },
  962. methods: {
  963. getAliveId: getAliveId,
  964. // 设置缓存项
  965. set: function set(key, item) {
  966. var cache = this.cache;
  967. this.$emit('update', key, item); // 更新缓存数据
  968. return cache[key] = item;
  969. },
  970. // 删除缓存项
  971. remove: function remove(key) {
  972. var cache = this.cache;
  973. var item = cache[key]; // 销毁组件实例
  974. if (item) {
  975. item.vm && item.vm.$destroy();
  976. delete cache[key];
  977. }
  978. this.$emit('remove', [key]);
  979. },
  980. // 清理缓存
  981. clear: function clear(key) {
  982. var item = this.cache[key];
  983. var vm = item && item.vm;
  984. if (vm) {
  985. vm.$destroy();
  986. item.vm = null;
  987. }
  988. }
  989. }
  990. });
  991. // CONCATENATED MODULE: ./src/mixins/routerTab/iframe.js
  992. // iframe 页签功能混入
  993. /* harmony default export */ var iframe = ({
  994. data: function data() {
  995. return {
  996. iframes: [],
  997. currentIframe: null
  998. };
  999. },
  1000. methods: {
  1001. // 获取 iframe 页签路由路径
  1002. getIframePath: function getIframePath(src) {
  1003. var title = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null;
  1004. var icon = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : null;
  1005. var path = "".concat(this.basePath, "/iframe/").concat(encodeURIComponent(src));
  1006. if (title) {
  1007. path += '/' + title;
  1008. if (icon) {
  1009. path += '/' + icon;
  1010. }
  1011. }
  1012. return path;
  1013. },
  1014. // 打开 iframe 页签
  1015. openIframeTab: function openIframeTab(src, title, icon) {
  1016. var path = this.getIframePath(src, title, icon);
  1017. this.$router.push(path);
  1018. },
  1019. // 关闭 iframe 页签
  1020. closeIframeTab: function closeIframeTab(src) {
  1021. var path = this.getIframePath(src);
  1022. this.close(path, false);
  1023. },
  1024. // 刷新 iframe 页签
  1025. refreshIframeTab: function refreshIframeTab(src) {
  1026. var path = this.getIframePath(src);
  1027. this.refresh(path, false);
  1028. }
  1029. }
  1030. });
  1031. // CONCATENATED MODULE: ./node_modules/cache-loader/dist/cjs.js??ref--12-0!./node_modules/thread-loader/dist/cjs.js!./node_modules/babel-loader/lib!./node_modules/@vue/cli-plugin-eslint/node_modules/eslint-loader??ref--13-0!./src/components/RouterTab.js?vue&type=script&lang=js&
  1032. 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); } }
  1033. 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); }); }; }
  1034. function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
  1035. // 方法
  1036. // 语言配置
  1037. // 子组件
  1038. // 功能混入
  1039. /* harmony default export */ var RouterTabvue_type_script_lang_js_ = ({
  1040. name: 'RouterTab',
  1041. components: {
  1042. RouterAlive: RouterAlive
  1043. },
  1044. mixins: [iframe],
  1045. props: {
  1046. // 缓存id,如果为函数,则参数为route
  1047. aliveId: RouterAlive.props.aliveId,
  1048. // 语言配置
  1049. // - 为字符串时,可以设置为内置的语言 'zh-CN' (默认) 和 'en'
  1050. // - 为对象时,可设置自定义的语言
  1051. i18n: {
  1052. type: [String, Object],
  1053. default: 'zh-CN'
  1054. },
  1055. // 初始页签数据
  1056. tabs: {
  1057. type: Array,
  1058. default: function _default() {
  1059. return [];
  1060. }
  1061. },
  1062. // router-view组件配置
  1063. routerView: Object,
  1064. // 页签过渡效果
  1065. tabTransition: {
  1066. type: [String, Object],
  1067. default: 'router-tab-zoom'
  1068. },
  1069. // 页面过渡效果
  1070. pageTransition: {
  1071. type: [String, Object],
  1072. default: function _default() {
  1073. return {
  1074. name: 'router-tab-swap',
  1075. mode: 'out-in'
  1076. };
  1077. }
  1078. }
  1079. },
  1080. data: function data() {
  1081. return {
  1082. loading: false,
  1083. // 路由页面loading
  1084. items: [],
  1085. // 页签项
  1086. activedTab: null,
  1087. // 当前激活的页签
  1088. isRouterAlive: true,
  1089. // 右键菜单
  1090. contextmenu: {
  1091. id: null,
  1092. index: -1,
  1093. left: 0,
  1094. top: 0
  1095. }
  1096. };
  1097. },
  1098. computed: {
  1099. // 语言内容
  1100. lang: function lang() {
  1101. var lang = null;
  1102. var i18n = this.i18n;
  1103. if (typeof i18n === 'string') {
  1104. lang = src_lang[i18n];
  1105. } else if (_typeof(i18n) === 'object') {
  1106. lang = i18n;
  1107. } // 找不到语言配置,则使用英文
  1108. if (!lang) lang = src_lang['en'];
  1109. return lang;
  1110. },
  1111. // 右键菜单是否当前页签
  1112. isContextTabActived: function isContextTabActived() {
  1113. return this.contextmenu.id === this.activedTab;
  1114. },
  1115. // 右键页签是否允许关闭
  1116. isContextTabCanBeClosed: function isContextTabCanBeClosed() {
  1117. var items = this.items,
  1118. contextmenu = this.contextmenu;
  1119. var contextTab = items[contextmenu.index];
  1120. return items.length > 1 && contextTab && contextTab.closable !== false;
  1121. },
  1122. // 左侧可关闭的页签
  1123. tabsLeft: function tabsLeft() {
  1124. var items = this.items,
  1125. _this$contextmenu = this.contextmenu,
  1126. id = _this$contextmenu.id,
  1127. index = _this$contextmenu.index;
  1128. return id ? items.slice(0, index).filter(function (_ref) {
  1129. var closable = _ref.closable;
  1130. return closable !== false;
  1131. }) : emptyArray;
  1132. },
  1133. // 左侧可关闭的页签
  1134. tabsRight: function tabsRight() {
  1135. var items = this.items,
  1136. _this$contextmenu2 = this.contextmenu,
  1137. id = _this$contextmenu2.id,
  1138. index = _this$contextmenu2.index;
  1139. return id ? items.slice(index + 1).filter(function (_ref2) {
  1140. var closable = _ref2.closable;
  1141. return closable !== false;
  1142. }) : emptyArray;
  1143. },
  1144. // 其他可关闭的页签
  1145. tabsOther: function tabsOther() {
  1146. var items = this.items,
  1147. id = this.contextmenu.id;
  1148. return id ? items.filter(function (_ref3) {
  1149. var closable = _ref3.closable,
  1150. tid = _ref3.id;
  1151. return closable !== false && id !== tid;
  1152. }) : emptyArray;
  1153. }
  1154. },
  1155. watch: {
  1156. // 路由切换更新激活的页签
  1157. $route: function $route(_$route) {
  1158. this.loading = false;
  1159. this.hideContextmenu();
  1160. this.updateActivedTab();
  1161. this.fixCommentPage();
  1162. },
  1163. activedTab: function () {
  1164. var _activedTab = _asyncToGenerator(
  1165. /*#__PURE__*/
  1166. regenerator_default.a.mark(function _callee() {
  1167. var $cur, $scr, cLeft, sLeft;
  1168. return regenerator_default.a.wrap(function _callee$(_context) {
  1169. while (1) {
  1170. switch (_context.prev = _context.next) {
  1171. case 0:
  1172. _context.next = 2;
  1173. return this.$nextTick();
  1174. case 2:
  1175. $cur = this.$el.querySelector('.router-tab-nav .actived');
  1176. $scr = this.$el.querySelector('.router-tab-scroll');
  1177. if ($cur) {
  1178. cLeft = $cur.offsetLeft;
  1179. sLeft = $scr.scrollLeft;
  1180. if (cLeft < sLeft || cLeft + $cur.clientWidth > sLeft + $scr.clientWidth) {
  1181. this.adjust();
  1182. }
  1183. }
  1184. case 5:
  1185. case "end":
  1186. return _context.stop();
  1187. }
  1188. }
  1189. }, _callee, this);
  1190. }));
  1191. function activedTab() {
  1192. return _activedTab.apply(this, arguments);
  1193. }
  1194. return activedTab;
  1195. }(),
  1196. // 监听右键菜单显示关闭
  1197. 'contextmenu.id': function contextmenuId(val, old) {
  1198. var _this = this;
  1199. if (!old && val) {
  1200. // 显示右键菜单,绑定点击关闭事件
  1201. document.addEventListener('click', this.onClick = function (e) {
  1202. if (e.target !== _this.$el.querySelector('.router-tab-contextmenu')) {
  1203. _this.hideContextmenu();
  1204. }
  1205. });
  1206. } else if (old && !val) {
  1207. // 隐藏右键菜单,移除点击关闭事件
  1208. document.removeEventListener('click', this.onClick);
  1209. }
  1210. }
  1211. },
  1212. beforeCreate: function beforeCreate() {
  1213. // 添加到原型链
  1214. external_commonjs_vue_commonjs2_vue_root_Vue_default.a.prototype.$routerTab = this; // 获取跟路径
  1215. var matched = this.$route.matched;
  1216. this.basePath = (matched[matched.length - 2] || {}).path;
  1217. },
  1218. created: function created() {
  1219. this.getTabItems();
  1220. this.updateActivedTab();
  1221. this.$router.beforeEach(this.routerPageLeaveGuard);
  1222. this.$nextTick(this.adjust);
  1223. },
  1224. mounted: function mounted() {
  1225. // 页面载入和浏览器窗口大小改变时调整Tab滚动显示
  1226. window.addEventListener('resize', this.onResize = debounce(this.adjust));
  1227. },
  1228. destroyed: function destroyed() {
  1229. // 销毁后移除监听事件
  1230. window.removeEventListener('resize', this.onResize);
  1231. },
  1232. methods: {
  1233. getAliveId: getAliveId,
  1234. // 页面离开导航守卫
  1235. routerPageLeaveGuard: function routerPageLeaveGuard(to, from, next) {
  1236. if (this._isDestroyed) {
  1237. var hooks = this.$router.beforeHooks;
  1238. var idx = hooks.indexOf(this.routerPageLeaveGuard); // 移除已销毁的RouterTab实例注册的导航守卫
  1239. if (idx > -1) hooks.splice(idx, 1);
  1240. next();
  1241. } else {
  1242. var id = this.getAliveId(to);
  1243. var $alive = this.$refs.routerAlive;
  1244. var _ref4 = $alive && $alive.cache[id] || emptyObj,
  1245. cacheRoute = _ref4.route; // 如果不是相同路由则检查beforePageLeave
  1246. if (cacheRoute && !isAlikeRoute(to, cacheRoute)) {
  1247. this.pageLeavePromise(id, 'replace').then(function () {
  1248. return next();
  1249. }).catch(function () {
  1250. return next(false);
  1251. });
  1252. } else {
  1253. next();
  1254. }
  1255. }
  1256. },
  1257. // 根据初始页签数据生成页签列表
  1258. getTabItems: function getTabItems() {
  1259. var _this2 = this;
  1260. var tabs = this.tabs,
  1261. $router = this.$router;
  1262. var ids = {};
  1263. this.items = tabs.map(function (item, index) {
  1264. var _ref5 = typeof item === 'string' ? {
  1265. to: item
  1266. } : item || emptyObj,
  1267. to = _ref5.to,
  1268. closable = _ref5.closable,
  1269. title = _ref5.title,
  1270. tips = _ref5.tips;
  1271. var route = to && $router.match(to);
  1272. if (route) {
  1273. var tab = _this2.getRouteTab(route);
  1274. var id = tab.id; // 根据id去重
  1275. if (!ids[id]) {
  1276. // 初始 tab 数据
  1277. if (title) tab.title = title;
  1278. if (tips) tab.tips = tips;
  1279. tab.closable = closable !== false;
  1280. return ids[id] = tab;
  1281. }
  1282. }
  1283. }).filter(function (item) {
  1284. return !!item;
  1285. });
  1286. },
  1287. // 更新激活的页签
  1288. updateActivedTab: function updateActivedTab() {
  1289. this.activedTab = this.getAliveId();
  1290. },
  1291. // 更新tab数据
  1292. updateTab: function updateTab(key, _ref6) {
  1293. var route = _ref6.route,
  1294. tab = _ref6.tab;
  1295. var items = this.items;
  1296. var matchIdx = items.findIndex(function (_ref7) {
  1297. var id = _ref7.id;
  1298. return id === key;
  1299. });
  1300. var item = Object.assign(this.getRouteTab(route), tab);
  1301. if (matchIdx > -1) {
  1302. var matchTab = items[matchIdx];
  1303. item.closable = matchTab.closable !== false;
  1304. this.$set(items, matchIdx, item);
  1305. } else {
  1306. items.push(item);
  1307. }
  1308. },
  1309. // 从路由地址获取 aliveId
  1310. getIdByLocation: function getIdByLocation(location) {
  1311. var fullMatch = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
  1312. if (!location) return;
  1313. var $route = this.$router.match(location, this.$router.currentRoute); // 路由地址精确匹配页签
  1314. if (fullMatch) {
  1315. var matchPath = getPathWithoutHash($route);
  1316. var matchTab = this.items.find(function (_ref8) {
  1317. var to = _ref8.to;
  1318. return to.split('#')[0] === matchPath;
  1319. });
  1320. if (matchTab) {
  1321. return matchTab.id;
  1322. }
  1323. } else {
  1324. return this.getAliveId($route);
  1325. }
  1326. },
  1327. // 从route中获取tab数据
  1328. getRouteTab: function getRouteTab(route) {
  1329. var id = this.getAliveId(route);
  1330. var to = route.fullPath,
  1331. meta = route.meta;
  1332. var title = meta.title,
  1333. icon = meta.icon,
  1334. tips = meta.tips;
  1335. return {
  1336. id: id,
  1337. to: to,
  1338. title: title,
  1339. icon: icon,
  1340. tips: tips
  1341. };
  1342. },
  1343. // 页面离开Promise
  1344. pageLeavePromise: function pageLeavePromise(id, type) {
  1345. var _this3 = this;
  1346. return new Promise(function (resolve, reject) {
  1347. var $alive = _this3.$refs.routerAlive;
  1348. var tab = _this3.items.find(function (item) {
  1349. return item.id === id;
  1350. }); // 当前页签
  1351. var _ref9 = $alive.cache[id] || emptyObj,
  1352. vm = _ref9.vm; // 缓存数据
  1353. var beforePageLeave = vm && vm.$vnode.componentOptions.Ctor.options.beforePageLeave;
  1354. if (typeof beforePageLeave === 'function') {
  1355. // 页签关闭前
  1356. beforePageLeave.bind(vm)(resolve, reject, tab, type);
  1357. } else {
  1358. resolve();
  1359. }
  1360. });
  1361. },
  1362. // 移除tab项
  1363. removeTab: function () {
  1364. var _removeTab = _asyncToGenerator(
  1365. /*#__PURE__*/
  1366. regenerator_default.a.mark(function _callee2(id) {
  1367. var items, $alive, idx;
  1368. return regenerator_default.a.wrap(function _callee2$(_context2) {
  1369. while (1) {
  1370. switch (_context2.prev = _context2.next) {
  1371. case 0:
  1372. items = this.items;
  1373. $alive = this.$refs.routerAlive;
  1374. idx = items.findIndex(function (item) {
  1375. return item.id === id;
  1376. });
  1377. if (!(items.length === 1)) {
  1378. _context2.next = 5;
  1379. break;
  1380. }
  1381. throw new Error(this.lang.msg.keepOneTab);
  1382. case 5:
  1383. _context2.prev = 5;
  1384. _context2.next = 8;
  1385. return this.pageLeavePromise(id, 'close');
  1386. case 8:
  1387. // 承诺关闭后移除页签和缓存
  1388. $alive.remove(id);
  1389. idx > -1 && items.splice(idx, 1);
  1390. _context2.next = 14;
  1391. break;
  1392. case 12:
  1393. _context2.prev = 12;
  1394. _context2.t0 = _context2["catch"](5);
  1395. case 14:
  1396. case "end":
  1397. return _context2.stop();
  1398. }
  1399. }
  1400. }, _callee2, this, [[5, 12]]);
  1401. }));
  1402. function removeTab(_x) {
  1403. return _removeTab.apply(this, arguments);
  1404. }
  1405. return removeTab;
  1406. }(),
  1407. // 通过路由地址关闭页签
  1408. close: function close(location) {
  1409. var fullMatch = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
  1410. if (location) {
  1411. var id = this.getIdByLocation(location, fullMatch);
  1412. if (id) {
  1413. this.closeTab(id);
  1414. }
  1415. } else {
  1416. this.closeTab();
  1417. }
  1418. },
  1419. // 通过页签id关闭页签
  1420. closeTab: function () {
  1421. var _closeTab = _asyncToGenerator(
  1422. /*#__PURE__*/
  1423. regenerator_default.a.mark(function _callee3() {
  1424. var id,
  1425. activedTab,
  1426. items,
  1427. $router,
  1428. idx,
  1429. nextTab,
  1430. _args3 = arguments;
  1431. return regenerator_default.a.wrap(function _callee3$(_context3) {
  1432. while (1) {
  1433. switch (_context3.prev = _context3.next) {
  1434. case 0:
  1435. id = _args3.length > 0 && _args3[0] !== undefined ? _args3[0] : this.activedTab;
  1436. activedTab = this.activedTab, items = this.items, $router = this.$router;
  1437. idx = items.findIndex(function (item) {
  1438. return item.id === id;
  1439. });
  1440. _context3.prev = 3;
  1441. _context3.next = 6;
  1442. return this.removeTab(id);
  1443. case 6:
  1444. // 如果关闭当前页签,则打开后一个页签
  1445. if (activedTab === id) {
  1446. nextTab = items[idx] || items[idx - 1];
  1447. $router.replace(nextTab.to);
  1448. }
  1449. _context3.next = 12;
  1450. break;
  1451. case 9:
  1452. _context3.prev = 9;
  1453. _context3.t0 = _context3["catch"](3);
  1454. console.warn(_context3.t0);
  1455. case 12:
  1456. case "end":
  1457. return _context3.stop();
  1458. }
  1459. }
  1460. }, _callee3, this, [[3, 9]]);
  1461. }));
  1462. function closeTab() {
  1463. return _closeTab.apply(this, arguments);
  1464. }
  1465. return closeTab;
  1466. }(),
  1467. // 关闭多个页签
  1468. closeMulti: function () {
  1469. var _closeMulti = _asyncToGenerator(
  1470. /*#__PURE__*/
  1471. regenerator_default.a.mark(function _callee4(tabs) {
  1472. var _this4 = this;
  1473. var items, $router, contextmenu, nextTab, _iteratorNormalCompletion, _didIteratorError, _iteratorError, _iterator, _step, id;
  1474. return regenerator_default.a.wrap(function _callee4$(_context4) {
  1475. while (1) {
  1476. switch (_context4.prev = _context4.next) {
  1477. case 0:
  1478. items = this.items, $router = this.$router, contextmenu = this.contextmenu;
  1479. nextTab = items.find(function (_ref10) {
  1480. var id = _ref10.id;
  1481. return id === contextmenu.id;
  1482. });
  1483. _iteratorNormalCompletion = true;
  1484. _didIteratorError = false;
  1485. _iteratorError = undefined;
  1486. _context4.prev = 5;
  1487. _iterator = tabs[Symbol.iterator]();
  1488. case 7:
  1489. if (_iteratorNormalCompletion = (_step = _iterator.next()).done) {
  1490. _context4.next = 19;
  1491. break;
  1492. }
  1493. id = _step.value.id;
  1494. _context4.prev = 9;
  1495. _context4.next = 12;
  1496. return this.removeTab(id);
  1497. case 12:
  1498. _context4.next = 16;
  1499. break;
  1500. case 14:
  1501. _context4.prev = 14;
  1502. _context4.t0 = _context4["catch"](9);
  1503. case 16:
  1504. _iteratorNormalCompletion = true;
  1505. _context4.next = 7;
  1506. break;
  1507. case 19:
  1508. _context4.next = 25;
  1509. break;
  1510. case 21:
  1511. _context4.prev = 21;
  1512. _context4.t1 = _context4["catch"](5);
  1513. _didIteratorError = true;
  1514. _iteratorError = _context4.t1;
  1515. case 25:
  1516. _context4.prev = 25;
  1517. _context4.prev = 26;
  1518. if (!_iteratorNormalCompletion && _iterator.return != null) {
  1519. _iterator.return();
  1520. }
  1521. case 28:
  1522. _context4.prev = 28;
  1523. if (!_didIteratorError) {
  1524. _context4.next = 31;
  1525. break;
  1526. }
  1527. throw _iteratorError;
  1528. case 31:
  1529. return _context4.finish(28);
  1530. case 32:
  1531. return _context4.finish(25);
  1532. case 33:
  1533. // 当前页签如已关闭,则打开右键选中页签
  1534. if (items.findIndex(function (_ref11) {
  1535. var id = _ref11.id;
  1536. return id === _this4.activedTab;
  1537. }) === -1) {
  1538. $router.replace(nextTab.to);
  1539. }
  1540. case 34:
  1541. case "end":
  1542. return _context4.stop();
  1543. }
  1544. }
  1545. }, _callee4, this, [[5, 21, 25, 33], [9, 14], [26,, 28, 32]]);
  1546. }));
  1547. function closeMulti(_x2) {
  1548. return _closeMulti.apply(this, arguments);
  1549. }
  1550. return closeMulti;
  1551. }(),
  1552. // 通过路由地址刷新页签
  1553. refresh: function refresh(location) {
  1554. var fullMatch = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
  1555. if (location) {
  1556. var id = this.getIdByLocation(location, fullMatch);
  1557. if (id) {
  1558. this.refreshTab(id);
  1559. }
  1560. } else {
  1561. this.refreshTab();
  1562. }
  1563. },
  1564. // 刷新指定页签
  1565. refreshTab: function () {
  1566. var _refreshTab = _asyncToGenerator(
  1567. /*#__PURE__*/
  1568. regenerator_default.a.mark(function _callee5() {
  1569. var id,
  1570. _args5 = arguments;
  1571. return regenerator_default.a.wrap(function _callee5$(_context5) {
  1572. while (1) {
  1573. switch (_context5.prev = _context5.next) {
  1574. case 0:
  1575. id = _args5.length > 0 && _args5[0] !== undefined ? _args5[0] : this.activedTab;
  1576. _context5.prev = 1;
  1577. _context5.next = 4;
  1578. return this.pageLeavePromise(id, 'refresh');
  1579. case 4:
  1580. this.$refs.routerAlive.clear(id);
  1581. if (id === this.activedTab) this.reloadRouter();
  1582. _context5.next = 10;
  1583. break;
  1584. case 8:
  1585. _context5.prev = 8;
  1586. _context5.t0 = _context5["catch"](1);
  1587. case 10:
  1588. case "end":
  1589. return _context5.stop();
  1590. }
  1591. }
  1592. }, _callee5, this, [[1, 8]]);
  1593. }));
  1594. function refreshTab() {
  1595. return _refreshTab.apply(this, arguments);
  1596. }
  1597. return refreshTab;
  1598. }(),
  1599. /**
  1600. * 刷新所有页签
  1601. * @param {boolean} [force=false] 是否强制刷新,如果强制则忽略页面beforePageLeave
  1602. */
  1603. refreshAll: function () {
  1604. var _refreshAll = _asyncToGenerator(
  1605. /*#__PURE__*/
  1606. regenerator_default.a.mark(function _callee6() {
  1607. var force,
  1608. $alive,
  1609. cache,
  1610. id,
  1611. _args6 = arguments;
  1612. return regenerator_default.a.wrap(function _callee6$(_context6) {
  1613. while (1) {
  1614. switch (_context6.prev = _context6.next) {
  1615. case 0:
  1616. force = _args6.length > 0 && _args6[0] !== undefined ? _args6[0] : false;
  1617. $alive = this.$refs.routerAlive;
  1618. cache = $alive.cache;
  1619. _context6.t0 = regenerator_default.a.keys(cache);
  1620. case 4:
  1621. if ((_context6.t1 = _context6.t0()).done) {
  1622. _context6.next = 20;
  1623. break;
  1624. }
  1625. id = _context6.t1.value;
  1626. if (force) {
  1627. _context6.next = 17;
  1628. break;
  1629. }
  1630. _context6.prev = 7;
  1631. _context6.next = 10;
  1632. return this.pageLeavePromise(id, 'refresh');
  1633. case 10:
  1634. $alive.clear(id);
  1635. _context6.next = 15;
  1636. break;
  1637. case 13:
  1638. _context6.prev = 13;
  1639. _context6.t2 = _context6["catch"](7);
  1640. case 15:
  1641. _context6.next = 18;
  1642. break;
  1643. case 17:
  1644. $alive.clear(id);
  1645. case 18:
  1646. _context6.next = 4;
  1647. break;
  1648. case 20:
  1649. this.reloadRouter();
  1650. case 21:
  1651. case "end":
  1652. return _context6.stop();
  1653. }
  1654. }
  1655. }, _callee6, this, [[7, 13]]);
  1656. }));
  1657. function refreshAll() {
  1658. return _refreshAll.apply(this, arguments);
  1659. }
  1660. return refreshAll;
  1661. }(),
  1662. // 重载路由组件
  1663. reloadRouter: function () {
  1664. var _reloadRouter = _asyncToGenerator(
  1665. /*#__PURE__*/
  1666. regenerator_default.a.mark(function _callee7() {
  1667. var ignoreTransition,
  1668. _args7 = arguments;
  1669. return regenerator_default.a.wrap(function _callee7$(_context7) {
  1670. while (1) {
  1671. switch (_context7.prev = _context7.next) {
  1672. case 0:
  1673. ignoreTransition = _args7.length > 0 && _args7[0] !== undefined ? _args7[0] : false;
  1674. this.isRouterAlive = false; // 默认在页面过渡结束后会设置 isRouterAlive 为 true
  1675. // 如果过渡事件失效,则需传入 ignoreTransition 为 true 手动更改
  1676. if (!ignoreTransition) {
  1677. _context7.next = 6;
  1678. break;
  1679. }
  1680. _context7.next = 5;
  1681. return this.$nextTick();
  1682. case 5:
  1683. this.isRouterAlive = true;
  1684. case 6:
  1685. case "end":
  1686. return _context7.stop();
  1687. }
  1688. }
  1689. }, _callee7, this);
  1690. }));
  1691. function reloadRouter() {
  1692. return _reloadRouter.apply(this, arguments);
  1693. }
  1694. return reloadRouter;
  1695. }(),
  1696. // 页签过渡结束
  1697. onTabTransitionEnd: function onTabTransitionEnd() {
  1698. this.adjust();
  1699. },
  1700. // 页面过渡结束
  1701. onPageTransitionEnd: function onPageTransitionEnd() {
  1702. if (!this.isRouterAlive) this.isRouterAlive = true;
  1703. },
  1704. // 显示页签右键菜单
  1705. showContextmenu: function showContextmenu(id, index, e) {
  1706. // 菜单定位
  1707. var _ref12 = e || emptyObj,
  1708. top = _ref12.clientY,
  1709. left = _ref12.clientX;
  1710. Object.assign(this.contextmenu, {
  1711. id: id,
  1712. index: index,
  1713. top: top,
  1714. left: left
  1715. });
  1716. },
  1717. // 关闭页签右键菜单
  1718. hideContextmenu: function hideContextmenu() {
  1719. this.showContextmenu(null, -1);
  1720. },
  1721. // Tab滚动
  1722. tabScroll: function tabScroll(direction) {
  1723. var $tab = this.$el.querySelector('.router-tab-header');
  1724. var $scr = $tab.querySelector('.router-tab-scroll');
  1725. var space = $tab.clientWidth - 110;
  1726. scrollTo($scr, $scr.scrollLeft + (direction === 'left' ? -space : space));
  1727. },
  1728. // 调整Tab滚动显示
  1729. adjust: function adjust() {
  1730. var $tab = this.$el.querySelector('.router-tab-header');
  1731. var $scr = $tab.querySelector('.router-tab-scroll');
  1732. var $nav = $scr.querySelector('.router-tab-nav');
  1733. var $cur = $nav.querySelector('.actived');
  1734. var isScroll = $nav.clientWidth > $scr.clientWidth; // 判断是否需要滚动
  1735. $tab.classList[isScroll ? 'add' : 'remove']('is-scroll');
  1736. if ($cur && isScroll) {
  1737. scrollTo($scr, $cur.offsetLeft + ($cur.clientWidth - $scr.clientWidth) / 2);
  1738. }
  1739. },
  1740. // 修复:当快速频繁切换页签时,旧页面离开过渡效果尚未完成,新页面内容无法正常mount,内容节点为comment类型
  1741. fixCommentPage: function fixCommentPage() {
  1742. if (this.$refs.routerAlive.$el.nodeType === 8) {
  1743. this.reloadRouter(true);
  1744. }
  1745. }
  1746. }
  1747. });
  1748. // CONCATENATED MODULE: ./src/components/RouterTab.js?vue&type=script&lang=js&
  1749. /* harmony default export */ var components_RouterTabvue_type_script_lang_js_ = (RouterTabvue_type_script_lang_js_);
  1750. // EXTERNAL MODULE: ./src/scss/routerTab.scss?vue&type=style&index=0&lang=scss&
  1751. var routerTabvue_type_style_index_0_lang_scss_ = __webpack_require__("e42d");
  1752. // EXTERNAL MODULE: ./src/scss/transition.scss?vue&type=style&index=1&lang=scss&
  1753. var transitionvue_type_style_index_1_lang_scss_ = __webpack_require__("4ba7");
  1754. // CONCATENATED MODULE: ./node_modules/vue-loader/lib/runtime/componentNormalizer.js
  1755. /* globals __VUE_SSR_CONTEXT__ */
  1756. // IMPORTANT: Do NOT use ES2015 features in this file (except for modules).
  1757. // This module is a runtime utility for cleaner component module output and will
  1758. // be included in the final webpack user bundle.
  1759. function normalizeComponent (
  1760. scriptExports,
  1761. render,
  1762. staticRenderFns,
  1763. functionalTemplate,
  1764. injectStyles,
  1765. scopeId,
  1766. moduleIdentifier, /* server only */
  1767. shadowMode /* vue-cli only */
  1768. ) {
  1769. // Vue.extend constructor export interop
  1770. var options = typeof scriptExports === 'function'
  1771. ? scriptExports.options
  1772. : scriptExports
  1773. // render functions
  1774. if (render) {
  1775. options.render = render
  1776. options.staticRenderFns = staticRenderFns
  1777. options._compiled = true
  1778. }
  1779. // functional template
  1780. if (functionalTemplate) {
  1781. options.functional = true
  1782. }
  1783. // scopedId
  1784. if (scopeId) {
  1785. options._scopeId = 'data-v-' + scopeId
  1786. }
  1787. var hook
  1788. if (moduleIdentifier) { // server build
  1789. hook = function (context) {
  1790. // 2.3 injection
  1791. context =
  1792. context || // cached call
  1793. (this.$vnode && this.$vnode.ssrContext) || // stateful
  1794. (this.parent && this.parent.$vnode && this.parent.$vnode.ssrContext) // functional
  1795. // 2.2 with runInNewContext: true
  1796. if (!context && typeof __VUE_SSR_CONTEXT__ !== 'undefined') {
  1797. context = __VUE_SSR_CONTEXT__
  1798. }
  1799. // inject component styles
  1800. if (injectStyles) {
  1801. injectStyles.call(this, context)
  1802. }
  1803. // register component module identifier for async chunk inferrence
  1804. if (context && context._registeredComponents) {
  1805. context._registeredComponents.add(moduleIdentifier)
  1806. }
  1807. }
  1808. // used by ssr in case component is cached and beforeCreate
  1809. // never gets called
  1810. options._ssrRegister = hook
  1811. } else if (injectStyles) {
  1812. hook = shadowMode
  1813. ? function () { injectStyles.call(this, this.$root.$options.shadowRoot) }
  1814. : injectStyles
  1815. }
  1816. if (hook) {
  1817. if (options.functional) {
  1818. // for template-only hot-reload because in that case the render fn doesn't
  1819. // go through the normalizer
  1820. options._injectStyles = hook
  1821. // register for functioal component in vue file
  1822. var originalRender = options.render
  1823. options.render = function renderWithStyleInjection (h, context) {
  1824. hook.call(context)
  1825. return originalRender(h, context)
  1826. }
  1827. } else {
  1828. // inject component registration as beforeCreate hook
  1829. var existing = options.beforeCreate
  1830. options.beforeCreate = existing
  1831. ? [].concat(existing, hook)
  1832. : [hook]
  1833. }
  1834. }
  1835. return {
  1836. exports: scriptExports,
  1837. options: options
  1838. }
  1839. }
  1840. // CONCATENATED MODULE: ./src/components/RouterTab.vue
  1841. /* normalize component */
  1842. var component = normalizeComponent(
  1843. components_RouterTabvue_type_script_lang_js_,
  1844. RouterTabvue_type_template_id_053ff978_render,
  1845. staticRenderFns,
  1846. false,
  1847. null,
  1848. null,
  1849. null
  1850. )
  1851. /* harmony default export */ var RouterTab = (component.exports);
  1852. // CONCATENATED MODULE: ./src/mixins/routerPage.js
  1853. // 路由页面混入
  1854. /* harmony default export */ var routerPage = ({
  1855. // 创建前记录缓存
  1856. created: function created() {
  1857. var $route = this.$route,
  1858. $vnode = this.$vnode;
  1859. var $alive = $vnode && $vnode.data.routerAlive;
  1860. if (!$alive) return false; // 标记为路由页面
  1861. this._isRouterPage = true;
  1862. var key = $alive.getAliveId($route); // 更新缓存数据
  1863. var cacheItem = $alive.set(key, {
  1864. route: $route,
  1865. vm: this
  1866. }); // 监听routerTab字段,更新页签信息
  1867. this.$watch('routeTab', function (val, old) {
  1868. cacheItem.tab = typeof val === 'string' ? {
  1869. title: val
  1870. } : val;
  1871. $alive.set(key, cacheItem);
  1872. }, {
  1873. deep: true,
  1874. immediate: true
  1875. });
  1876. },
  1877. // 解决webpack热加载后组件缓存不更新
  1878. activated: function activated() {
  1879. if (!this._isRouterPage) return false;
  1880. var ctorId = this.$vnode.componentOptions.Ctor.cid; // 热加载后Ctor.cid改变
  1881. if (this._ctorId && this._ctorId !== ctorId) {
  1882. this.$destroy();
  1883. this.$routerTab.refreshTab();
  1884. }
  1885. this._ctorId = ctorId;
  1886. }
  1887. });
  1888. // CONCATENATED MODULE: ./node_modules/cache-loader/dist/cjs.js?{"cacheDirectory":"node_modules/.cache/vue-loader","cacheIdentifier":"33e18d7e-vue-loader-template"}!./node_modules/vue-loader/lib/loaders/templateLoader.js??vue-loader-options!./node_modules/cache-loader/dist/cjs.js??ref--0-0!./node_modules/vue-loader/lib??vue-loader-options!./src/page/Iframe.vue?vue&type=template&id=5f2f2831&
  1889. var Iframevue_type_template_id_5f2f2831_render = function () {var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;return _c('div',{staticClass:"router-tab-iframe-fake"})}
  1890. var Iframevue_type_template_id_5f2f2831_staticRenderFns = []
  1891. // CONCATENATED MODULE: ./src/page/Iframe.vue?vue&type=template&id=5f2f2831&
  1892. // CONCATENATED MODULE: ./node_modules/cache-loader/dist/cjs.js??ref--12-0!./node_modules/thread-loader/dist/cjs.js!./node_modules/babel-loader/lib!./node_modules/cache-loader/dist/cjs.js??ref--0-0!./node_modules/vue-loader/lib??vue-loader-options!./src/page/Iframe.vue?vue&type=script&lang=js&
  1893. //
  1894. //
  1895. //
  1896. //
  1897. /* harmony default export */ var Iframevue_type_script_lang_js_ = ({
  1898. name: 'Iframe',
  1899. props: {
  1900. src: String,
  1901. title: String,
  1902. icon: String
  1903. },
  1904. data: function data() {
  1905. return {
  1906. routeTab: null
  1907. };
  1908. },
  1909. mounted: function mounted() {
  1910. var src = this.src,
  1911. title = this.title,
  1912. icon = this.icon,
  1913. $tab = this.$routerTab;
  1914. var iframes = $tab.iframes;
  1915. this.routeTab = {
  1916. title: title,
  1917. icon: icon
  1918. };
  1919. if (!iframes.includes(src)) {
  1920. iframes.push(src);
  1921. }
  1922. $tab.currentIframe = src;
  1923. },
  1924. activated: function activated() {
  1925. this.$routerTab.currentIframe = this.src;
  1926. },
  1927. deactivated: function deactivated() {
  1928. this.$routerTab.currentIframe = null;
  1929. },
  1930. destroyed: function destroyed() {
  1931. var src = this.src;
  1932. var iframes = this.$routerTab.iframes;
  1933. var index = iframes.indexOf(src);
  1934. if (index > -1) {
  1935. iframes.splice(index, 1);
  1936. }
  1937. }
  1938. });
  1939. // CONCATENATED MODULE: ./src/page/Iframe.vue?vue&type=script&lang=js&
  1940. /* harmony default export */ var page_Iframevue_type_script_lang_js_ = (Iframevue_type_script_lang_js_);
  1941. // CONCATENATED MODULE: ./src/page/Iframe.vue
  1942. /* normalize component */
  1943. var Iframe_component = normalizeComponent(
  1944. page_Iframevue_type_script_lang_js_,
  1945. Iframevue_type_template_id_5f2f2831_render,
  1946. Iframevue_type_template_id_5f2f2831_staticRenderFns,
  1947. false,
  1948. null,
  1949. null,
  1950. null
  1951. )
  1952. /* harmony default export */ var Iframe = (Iframe_component.exports);
  1953. // CONCATENATED MODULE: ./src/util/routes.js
  1954. // 注入的路由
  1955. /* harmony default export */ var routes = ([{
  1956. // iframe 路由
  1957. path: 'iframe/:src/:title?/:icon?',
  1958. component: Iframe,
  1959. props: true,
  1960. meta: {
  1961. aliveId: function aliveId(route) {
  1962. return "iframe-".concat(route.params.src);
  1963. }
  1964. }
  1965. }]);
  1966. // CONCATENATED MODULE: ./src/index.js
  1967. // 安装
  1968. RouterTab.install = function install(Vue, options) {
  1969. if (install.installed) return;
  1970. install.installed = true;
  1971. Vue.component(RouterTab.name, RouterTab);
  1972. Vue.mixin(routerPage);
  1973. }; // 如果浏览器环境且拥有全局Vue,则自动安装组件
  1974. if (typeof window !== 'undefined' && window.Vue) {
  1975. window.Vue.use(RouterTab);
  1976. }
  1977. /* harmony default export */ var src = (RouterTab); // 路由
  1978. var RouterTabRoutes = routes;
  1979. // CONCATENATED MODULE: ./node_modules/@vue/cli-service/lib/commands/build/entry-lib.js
  1980. /* concated harmony reexport RouterTabRoutes */__webpack_require__.d(__webpack_exports__, "RouterTabRoutes", function() { return RouterTabRoutes; });
  1981. /* harmony default export */ var entry_lib = __webpack_exports__["default"] = (src);
  1982. /***/ })
  1983. /******/ });
  1984. //# sourceMappingURL=vue-router-tab.common.js.map