vue-router-tab.umd.js 79 KB

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