vue-router-tab.common.js 74 KB

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