vue-router-tab.common.js 74 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205
  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. /***/ "199b":
  90. /***/ (function(module, exports, __webpack_require__) {
  91. // extracted by mini-css-extract-plugin
  92. /***/ }),
  93. /***/ "8880":
  94. /***/ (function(module, exports, __webpack_require__) {
  95. // extracted by mini-css-extract-plugin
  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. /***/ "a34a":
  716. /***/ (function(module, exports, __webpack_require__) {
  717. module.exports = __webpack_require__("bbdd");
  718. /***/ }),
  719. /***/ "bbdd":
  720. /***/ (function(module, exports, __webpack_require__) {
  721. /**
  722. * Copyright (c) 2014-present, Facebook, Inc.
  723. *
  724. * This source code is licensed under the MIT license found in the
  725. * LICENSE file in the root directory of this source tree.
  726. */
  727. // This method of obtaining a reference to the global object needs to be
  728. // kept identical to the way it is obtained in runtime.js
  729. var g = (function() {
  730. return this || (typeof self === "object" && self);
  731. })() || Function("return this")();
  732. // Use `getOwnPropertyNames` because not all browsers support calling
  733. // `hasOwnProperty` on the global `self` object in a worker. See #183.
  734. var hadRuntime = g.regeneratorRuntime &&
  735. Object.getOwnPropertyNames(g).indexOf("regeneratorRuntime") >= 0;
  736. // Save the old regeneratorRuntime in case it needs to be restored later.
  737. var oldRuntime = hadRuntime && g.regeneratorRuntime;
  738. // Force reevalutation of runtime.js.
  739. g.regeneratorRuntime = undefined;
  740. module.exports = __webpack_require__("96cf");
  741. if (hadRuntime) {
  742. // Restore the original runtime.
  743. g.regeneratorRuntime = oldRuntime;
  744. } else {
  745. // Remove the global property added by runtime.js.
  746. try {
  747. delete g.regeneratorRuntime;
  748. } catch(e) {
  749. g.regeneratorRuntime = undefined;
  750. }
  751. }
  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_cli_service_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__("199b");
  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_cli_service_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_cli_service_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_cli_service_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_cli_service_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__("8880");
  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_cli_service_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_cli_service_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_cli_service_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":"5ea164b9-vue-loader-template"}!./node_modules/@vue/cli-service/node_modules/vue-loader/lib/loaders/templateLoader.js??vue-loader-options!./node_modules/cache-loader/dist/cjs.js??ref--0-0!./node_modules/@vue/cli-service/node_modules/vue-loader/lib??vue-loader-options!./src/lib/RouterTab/components/RouterTab.vue?vue&type=template&id=6424321e&
  823. var RouterTabvue_type_template_id_6424321e_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=6424321e&
  837. // EXTERNAL MODULE: ./node_modules/@babel/runtime/regenerator/index.js
  838. var regenerator = __webpack_require__("a34a");
  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/util.js
  844. // 空对象和数组
  845. var emptyObj = Object.create(null);
  846. var emptyArray = []; // 是否定义
  847. function isDef(v) {
  848. return v !== undefined && v !== null;
  849. } // 防抖
  850. function debounce(fn) {
  851. var delay = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 200;
  852. var timeout = null;
  853. return function () {
  854. var context = this;
  855. var args = arguments;
  856. clearTimeout(timeout);
  857. timeout = setTimeout(function () {
  858. fn.call(context, args);
  859. }, delay);
  860. };
  861. } // 滚动
  862. function scrollTo($el) {
  863. var left = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
  864. var top = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 0;
  865. if ($el.scrollTo) {
  866. $el.scrollTo({
  867. left: left,
  868. top: top,
  869. behavior: 'smooth'
  870. });
  871. } else {
  872. $el.scrollLeft = left;
  873. $el.scrollTop = top;
  874. }
  875. }
  876. /* 组件方法 */
  877. // 获取第一个子组件
  878. function getFirstComponentChild(children) {
  879. if (Array.isArray(children)) {
  880. for (var i = 0; i < children.length; i++) {
  881. var c = children[i];
  882. if (isDef(c) && (isDef(c.componentOptions) || isAsyncPlaceholder(c))) {
  883. return c;
  884. }
  885. }
  886. }
  887. } // 获取缓存key
  888. function getAliveId() {
  889. var route = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : this.$route;
  890. var aliveId = route.meta && route.meta.aliveId || this.aliveId || 'path';
  891. if (typeof aliveId === 'function') {
  892. return aliveId.bind(this)(route);
  893. }
  894. return route[aliveId];
  895. }
  896. /* 路由方法 */
  897. // 是否异步占位
  898. function isAsyncPlaceholder(node) {
  899. return node.isComment && node.asyncFactory;
  900. } // 获取路由不带hash的路径
  901. function getPathWithoutHash(route) {
  902. return route.hash ? route.fullPath.replace(route.hash, '') : route.fullPath;
  903. } // 是否相似路由
  904. function isAlikeRoute(route1, route2) {
  905. return getPathWithoutHash(route1) === getPathWithoutHash(route2);
  906. } // 获取路由页面组件
  907. function getRouteComponent(_ref) {
  908. var matched = _ref.matched;
  909. return matched[matched.length - 1].components.default;
  910. } // 路由是否共用组件
  911. function isSameComponentRoute(route1, route2) {
  912. return getRouteComponent(route1) === getRouteComponent(route2);
  913. }
  914. // CONCATENATED MODULE: ./src/lib/RouterTab/components/RouterAlive.js
  915. /* harmony default export */ var RouterAlive = ({
  916. name: 'RouterAlive',
  917. props: {
  918. // 缓存key,如果为函数,则参数为route
  919. aliveId: {
  920. type: [String, Function],
  921. default: 'path'
  922. }
  923. },
  924. beforeCreate: function beforeCreate() {
  925. Object.assign(this, {
  926. cache: Object.create(null),
  927. lastRoute: this.$route
  928. });
  929. },
  930. render: function render() {
  931. var slot = this.$slots.default;
  932. var vnode = getFirstComponentChild(slot);
  933. var vmOpts = vnode && vnode.componentOptions;
  934. if (vmOpts) {
  935. var cache = this.cache,
  936. $route = this.$route,
  937. lastRoute = this.lastRoute; // 如果是transition组件,页面组件则为子元素
  938. var pageNode = vmOpts.tag === 'transition' ? vmOpts.children[0] : vnode;
  939. if (pageNode && pageNode.componentOptions) {
  940. // 获取缓存
  941. var key = this.getAliveId();
  942. var cacheItem = cache[key];
  943. var _ref = cacheItem || emptyObj,
  944. cacheVm = _ref.vm,
  945. cacheRoute = _ref.route; // 是否需要重载路由强制刷新页面组件
  946. var needReloadRouter = false; // 路由是否改变
  947. var isRouteChange = lastRoute !== $route; // 是否跟上次路由共用组件
  948. var isSameComponent = isRouteChange && isSameComponentRoute($route, lastRoute);
  949. if (isRouteChange) {
  950. // 更新上次路由
  951. this.lastRoute = $route; // 添加缓存
  952. if (!cacheItem) this.set(key, {
  953. route: $route
  954. });
  955. }
  956. if (cacheVm) {
  957. // 缓存组件的路由地址除hash外一致则取缓存的组件
  958. if (isAlikeRoute(cacheRoute, $route)) {
  959. pageNode.componentInstance = cacheVm;
  960. } else {
  961. // 缓存组件路由地址不匹配则销毁缓存并重载路由
  962. cacheVm.$destroy();
  963. cacheItem.vm = null;
  964. needReloadRouter = true;
  965. }
  966. } // 路由改变后但组件相同需重载路由
  967. if (isSameComponent) needReloadRouter = true; // 重载路由以强制更新页面
  968. needReloadRouter && this.$routerTab.reloadRouter(); // 标记为keepAlive和routerAlive
  969. pageNode.data.keepAlive = true;
  970. pageNode.data.routerAlive = this;
  971. }
  972. }
  973. return vnode || slot && slot[0];
  974. },
  975. methods: {
  976. getAliveId: getAliveId,
  977. // 设置缓存项
  978. set: function set(key, item) {
  979. var cache = this.cache;
  980. this.$emit('update', key, item); // 更新缓存数据
  981. return cache[key] = item;
  982. },
  983. // 删除缓存项
  984. remove: function remove(key) {
  985. var cache = this.cache;
  986. var item = cache[key]; // 销毁组件实例
  987. if (item) {
  988. item.vm && item.vm.$destroy();
  989. delete cache[key];
  990. }
  991. this.$emit('remove', [key]);
  992. },
  993. // 清理缓存
  994. clear: function clear(key) {
  995. var item = this.cache[key];
  996. var vm = item && item.vm;
  997. if (vm) {
  998. vm.$destroy();
  999. item.vm = null;
  1000. }
  1001. }
  1002. }
  1003. });
  1004. // CONCATENATED MODULE: ./src/lib/RouterTab/lang/zh-CN.js
  1005. /* harmony default export */ var zh_CN = ({
  1006. tab: {
  1007. untitled: '无标题'
  1008. },
  1009. contextmenu: {
  1010. refresh: '刷新',
  1011. refreshAll: '刷新所有',
  1012. close: '关闭',
  1013. closeLefts: '关闭左侧',
  1014. closeRights: '关闭右侧',
  1015. closeOthers: '关闭其他'
  1016. },
  1017. msg: {
  1018. keepOneTab: '至少应保留1个页签'
  1019. }
  1020. });
  1021. // CONCATENATED MODULE: ./src/lib/RouterTab/lang/en.js
  1022. /* harmony default export */ var en = ({
  1023. tab: {
  1024. untitled: 'Untitled'
  1025. },
  1026. contextmenu: {
  1027. refresh: 'Refresh',
  1028. refreshAll: 'Refresh All',
  1029. close: 'Close',
  1030. closeLefts: 'Close to the Left',
  1031. closeRights: 'Close to the Right',
  1032. closeOthers: 'Close Others'
  1033. },
  1034. msg: {
  1035. keepOneTab: 'Keep at least 1 tab'
  1036. }
  1037. });
  1038. // CONCATENATED MODULE: ./src/lib/RouterTab/lang/index.js
  1039. /* harmony default export */ var RouterTab_lang = ({
  1040. 'zh-CN': zh_CN,
  1041. en: en
  1042. });
  1043. // 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&
  1044. 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); } }
  1045. 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); }); }; }
  1046. 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); }
  1047. /* harmony default export */ var RouterTabvue_type_script_lang_js_ = ({
  1048. name: 'RouterTab',
  1049. components: {
  1050. RouterAlive: RouterAlive
  1051. },
  1052. props: {
  1053. // 缓存key,如果为函数,则参数为route
  1054. aliveId: RouterAlive.props.aliveId,
  1055. // 语言配置
  1056. // - 为字符串时,可以设置为内置的语言 'zh-CN' (默认) 和 'en'
  1057. // - 为对象时,可设置自定义的语言
  1058. i18n: {
  1059. type: [String, Object],
  1060. default: 'zh-CN'
  1061. },
  1062. // 初始页签数据
  1063. tabs: {
  1064. type: Array,
  1065. default: function _default() {
  1066. return [];
  1067. }
  1068. },
  1069. // router-view组件配置
  1070. routerView: Object,
  1071. // 页签过渡效果
  1072. tabTransition: {
  1073. type: [String, Object],
  1074. default: 'router-tab-zoom'
  1075. },
  1076. // 页面过渡效果
  1077. pageTransition: {
  1078. type: [String, Object],
  1079. default: function _default() {
  1080. return {
  1081. name: 'router-tab-swap',
  1082. mode: 'out-in'
  1083. };
  1084. }
  1085. }
  1086. },
  1087. data: function data() {
  1088. return {
  1089. loading: false,
  1090. // 路由页面loading
  1091. items: [],
  1092. // 页签项
  1093. activedTab: null,
  1094. // 当前激活的页签
  1095. isRouterAlive: true,
  1096. // 右键菜单
  1097. contextmenu: {
  1098. id: null,
  1099. index: -1,
  1100. left: 0,
  1101. top: 0
  1102. }
  1103. };
  1104. },
  1105. computed: {
  1106. // 语言内容
  1107. lang: function lang() {
  1108. var lang = null;
  1109. var i18n = this.i18n;
  1110. if (typeof i18n === 'string') {
  1111. lang = RouterTab_lang[i18n];
  1112. } else if (_typeof(i18n) === 'object') {
  1113. lang = i18n;
  1114. } // 找不到语言配置,则使用英文
  1115. if (!lang) lang = RouterTab_lang['en'];
  1116. return lang;
  1117. },
  1118. // 右键菜单是否当前页签
  1119. isContextTabActived: function isContextTabActived() {
  1120. return this.contextmenu.id === this.activedTab;
  1121. },
  1122. // 右键页签是否允许关闭
  1123. isContextTabCanBeClosed: function isContextTabCanBeClosed() {
  1124. var items = this.items,
  1125. contextmenu = this.contextmenu;
  1126. var contextTab = items[contextmenu.index];
  1127. return items.length > 1 && contextTab && contextTab.closable !== false;
  1128. },
  1129. // 左侧可关闭的页签
  1130. tabsLeft: function tabsLeft() {
  1131. var items = this.items,
  1132. _this$contextmenu = this.contextmenu,
  1133. id = _this$contextmenu.id,
  1134. index = _this$contextmenu.index;
  1135. return id ? items.slice(0, index).filter(function (_ref) {
  1136. var closable = _ref.closable;
  1137. return closable !== false;
  1138. }) : emptyArray;
  1139. },
  1140. // 左侧可关闭的页签
  1141. tabsRight: function tabsRight() {
  1142. var items = this.items,
  1143. _this$contextmenu2 = this.contextmenu,
  1144. id = _this$contextmenu2.id,
  1145. index = _this$contextmenu2.index;
  1146. return id ? items.slice(index + 1).filter(function (_ref2) {
  1147. var closable = _ref2.closable;
  1148. return closable !== false;
  1149. }) : emptyArray;
  1150. },
  1151. // 其他可关闭的页签
  1152. tabsOther: function tabsOther() {
  1153. var items = this.items,
  1154. id = this.contextmenu.id;
  1155. return id ? items.filter(function (_ref3) {
  1156. var closable = _ref3.closable,
  1157. tid = _ref3.id;
  1158. return closable !== false && id !== tid;
  1159. }) : emptyArray;
  1160. }
  1161. },
  1162. watch: {
  1163. // 路由切换更新激活的页签
  1164. $route: function $route(_$route) {
  1165. this.loading = false;
  1166. this.hideContextmenu();
  1167. this.updateActivedTab();
  1168. this.fixCommentPage();
  1169. },
  1170. activedTab: function () {
  1171. var _activedTab = _asyncToGenerator(
  1172. /*#__PURE__*/
  1173. regenerator_default.a.mark(function _callee() {
  1174. var $cur, $scr, cLeft, sLeft;
  1175. return regenerator_default.a.wrap(function _callee$(_context) {
  1176. while (1) {
  1177. switch (_context.prev = _context.next) {
  1178. case 0:
  1179. _context.next = 2;
  1180. return this.$nextTick();
  1181. case 2:
  1182. $cur = this.$el.querySelector('.router-tab-nav .actived');
  1183. $scr = this.$el.querySelector('.router-tab-scroll');
  1184. if ($cur) {
  1185. cLeft = $cur.offsetLeft;
  1186. sLeft = $scr.scrollLeft;
  1187. if (cLeft < sLeft || cLeft + $cur.clientWidth > sLeft + $scr.clientWidth) {
  1188. this.adjust();
  1189. }
  1190. }
  1191. case 5:
  1192. case "end":
  1193. return _context.stop();
  1194. }
  1195. }
  1196. }, _callee, this);
  1197. }));
  1198. function activedTab() {
  1199. return _activedTab.apply(this, arguments);
  1200. }
  1201. return activedTab;
  1202. }(),
  1203. // 监听右键菜单显示关闭
  1204. 'contextmenu.id': function contextmenuId(val, old) {
  1205. var _this = this;
  1206. if (!old && val) {
  1207. // 显示右键菜单,绑定点击关闭事件
  1208. document.addEventListener('click', this.onClick = function (e) {
  1209. if (e.target !== _this.$el.querySelector('.router-tab-contextmenu')) {
  1210. _this.hideContextmenu();
  1211. }
  1212. });
  1213. } else if (old && !val) {
  1214. // 隐藏右键菜单,移除点击关闭事件
  1215. document.removeEventListener('click', this.onClick);
  1216. }
  1217. }
  1218. },
  1219. beforeCreate: function beforeCreate() {
  1220. // 添加到原型链
  1221. external_commonjs_vue_commonjs2_vue_root_Vue_default.a.prototype.$routerTab = this;
  1222. },
  1223. created: function created() {
  1224. this.getTabItems();
  1225. this.updateActivedTab();
  1226. this.$router.beforeEach(this.routerPageLeaveGuard);
  1227. this.$nextTick(this.adjust);
  1228. },
  1229. mounted: function mounted() {
  1230. // 页面载入和浏览器窗口大小改变时调整Tab滚动显示
  1231. window.addEventListener('resize', this.onResize = debounce(this.adjust));
  1232. },
  1233. destroyed: function destroyed() {
  1234. // 销毁后移除监听事件
  1235. window.removeEventListener('resize', this.onResize);
  1236. },
  1237. methods: {
  1238. getAliveId: getAliveId,
  1239. // 页面离开导航守卫
  1240. routerPageLeaveGuard: function routerPageLeaveGuard(to, from, next) {
  1241. if (this._isDestroyed) {
  1242. var hooks = this.$router.beforeHooks;
  1243. var idx = hooks.indexOf(this.routerPageLeaveGuard); // 移除已销毁的RouterTab实例注册的导航守卫
  1244. if (idx > -1) hooks.splice(idx, 1);
  1245. next();
  1246. } else {
  1247. var id = this.getAliveId(to);
  1248. var $alive = this.$refs.routerAlive;
  1249. var _ref4 = $alive && $alive.cache[id] || emptyObj,
  1250. cacheRoute = _ref4.route; // 如果不是相同路由则检查beforePageLeave
  1251. if (cacheRoute && !isAlikeRoute(to, cacheRoute)) {
  1252. this.pageLeavePromise(id, 'replace').then(function () {
  1253. return next();
  1254. }).catch(function () {
  1255. return next(false);
  1256. });
  1257. } else {
  1258. next();
  1259. }
  1260. }
  1261. },
  1262. // 根据初始页签数据生成页签列表
  1263. getTabItems: function getTabItems() {
  1264. var _this2 = this;
  1265. var tabs = this.tabs,
  1266. $router = this.$router;
  1267. var ids = {};
  1268. this.items = tabs.map(function (item, index) {
  1269. var _ref5 = typeof item === 'string' ? {
  1270. to: item
  1271. } : item || emptyObj,
  1272. to = _ref5.to,
  1273. closable = _ref5.closable,
  1274. title = _ref5.title,
  1275. tips = _ref5.tips;
  1276. var route = to && $router.match(to);
  1277. if (route) {
  1278. var tab = _this2.getRouteTab(route);
  1279. var id = tab.id; // 根据id去重
  1280. if (!ids[id]) {
  1281. // 初始 tab 数据
  1282. if (title) tab.title = title;
  1283. if (tips) tab.tips = tips;
  1284. tab.closable = closable !== false;
  1285. return ids[id] = tab;
  1286. }
  1287. }
  1288. }).filter(function (item) {
  1289. return !!item;
  1290. });
  1291. },
  1292. // 更新激活的页签
  1293. updateActivedTab: function updateActivedTab() {
  1294. this.activedTab = this.getAliveId();
  1295. },
  1296. // 更新tab数据
  1297. updateTab: function updateTab(key, _ref6) {
  1298. var route = _ref6.route,
  1299. tab = _ref6.tab;
  1300. var items = this.items;
  1301. var matchIdx = items.findIndex(function (_ref7) {
  1302. var id = _ref7.id;
  1303. return id === key;
  1304. });
  1305. var item = Object.assign(this.getRouteTab(route), tab);
  1306. if (matchIdx > -1) {
  1307. var matchTab = items[matchIdx];
  1308. item.closable = matchTab.closable !== false;
  1309. this.$set(items, matchIdx, item);
  1310. } else {
  1311. items.push(item);
  1312. }
  1313. },
  1314. // 从路由地址获取 aliveId
  1315. getIdByLocation: function getIdByLocation(location) {
  1316. var fullMatch = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
  1317. if (!location) return;
  1318. var $route = this.$router.match(location, this.$router.currentRoute); // 路由地址精确匹配页签
  1319. if (fullMatch) {
  1320. var matchPath = getPathWithoutHash($route);
  1321. var matchTab = this.items.find(function (_ref8) {
  1322. var to = _ref8.to;
  1323. return to.split('#')[0] === matchPath;
  1324. });
  1325. if (matchTab) {
  1326. return matchTab.id;
  1327. }
  1328. } else {
  1329. return this.getAliveId($route);
  1330. }
  1331. },
  1332. // 从route中获取tab数据
  1333. getRouteTab: function getRouteTab(route) {
  1334. var id = this.getAliveId(route);
  1335. var to = route.fullPath,
  1336. meta = route.meta;
  1337. var title = meta.title,
  1338. icon = meta.icon,
  1339. tips = meta.tips;
  1340. return {
  1341. id: id,
  1342. to: to,
  1343. title: title,
  1344. icon: icon,
  1345. tips: tips
  1346. };
  1347. },
  1348. // 页面离开Promise
  1349. pageLeavePromise: function pageLeavePromise(id, type) {
  1350. var _this3 = this;
  1351. return new Promise(function (resolve, reject) {
  1352. var $alive = _this3.$refs.routerAlive;
  1353. var tab = _this3.items.find(function (item) {
  1354. return item.id === id;
  1355. }); // 当前页签
  1356. var _ref9 = $alive.cache[id] || emptyObj,
  1357. vm = _ref9.vm; // 缓存数据
  1358. var beforePageLeave = vm && vm.$vnode.componentOptions.Ctor.options.beforePageLeave;
  1359. if (typeof beforePageLeave === 'function') {
  1360. // 页签关闭前
  1361. beforePageLeave.bind(vm)(resolve, reject, tab, type);
  1362. } else {
  1363. resolve();
  1364. }
  1365. });
  1366. },
  1367. // 移除tab项
  1368. removeTab: function () {
  1369. var _removeTab = _asyncToGenerator(
  1370. /*#__PURE__*/
  1371. regenerator_default.a.mark(function _callee2(id) {
  1372. var items, $alive, idx;
  1373. return regenerator_default.a.wrap(function _callee2$(_context2) {
  1374. while (1) {
  1375. switch (_context2.prev = _context2.next) {
  1376. case 0:
  1377. items = this.items;
  1378. $alive = this.$refs.routerAlive;
  1379. idx = items.findIndex(function (item) {
  1380. return item.id === id;
  1381. });
  1382. if (!(items.length === 1)) {
  1383. _context2.next = 5;
  1384. break;
  1385. }
  1386. throw new Error(this.lang.msg.keepOneTab);
  1387. case 5:
  1388. _context2.prev = 5;
  1389. _context2.next = 8;
  1390. return this.pageLeavePromise(id, 'close');
  1391. case 8:
  1392. // 承诺关闭后移除页签和缓存
  1393. $alive.remove(id);
  1394. idx > -1 && items.splice(idx, 1);
  1395. _context2.next = 14;
  1396. break;
  1397. case 12:
  1398. _context2.prev = 12;
  1399. _context2.t0 = _context2["catch"](5);
  1400. case 14:
  1401. case "end":
  1402. return _context2.stop();
  1403. }
  1404. }
  1405. }, _callee2, this, [[5, 12]]);
  1406. }));
  1407. function removeTab(_x) {
  1408. return _removeTab.apply(this, arguments);
  1409. }
  1410. return removeTab;
  1411. }(),
  1412. // 通过路由地址关闭页签
  1413. close: function close(location) {
  1414. var fullMatch = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
  1415. if (location) {
  1416. var id = this.getIdByLocation(location, fullMatch);
  1417. if (id) {
  1418. this.closeTab(id);
  1419. }
  1420. } else {
  1421. this.closeTab();
  1422. }
  1423. },
  1424. // 通过页签id关闭页签
  1425. closeTab: function () {
  1426. var _closeTab = _asyncToGenerator(
  1427. /*#__PURE__*/
  1428. regenerator_default.a.mark(function _callee3() {
  1429. var id,
  1430. activedTab,
  1431. items,
  1432. $router,
  1433. idx,
  1434. nextTab,
  1435. _args3 = arguments;
  1436. return regenerator_default.a.wrap(function _callee3$(_context3) {
  1437. while (1) {
  1438. switch (_context3.prev = _context3.next) {
  1439. case 0:
  1440. id = _args3.length > 0 && _args3[0] !== undefined ? _args3[0] : this.activedTab;
  1441. activedTab = this.activedTab, items = this.items, $router = this.$router;
  1442. idx = items.findIndex(function (item) {
  1443. return item.id === id;
  1444. });
  1445. _context3.prev = 3;
  1446. _context3.next = 6;
  1447. return this.removeTab(id);
  1448. case 6:
  1449. // 如果关闭当前页签,则打开后一个页签
  1450. if (activedTab === id) {
  1451. nextTab = items[idx] || items[idx - 1];
  1452. $router.replace(nextTab.to);
  1453. }
  1454. _context3.next = 12;
  1455. break;
  1456. case 9:
  1457. _context3.prev = 9;
  1458. _context3.t0 = _context3["catch"](3);
  1459. console.warn(_context3.t0);
  1460. case 12:
  1461. case "end":
  1462. return _context3.stop();
  1463. }
  1464. }
  1465. }, _callee3, this, [[3, 9]]);
  1466. }));
  1467. function closeTab() {
  1468. return _closeTab.apply(this, arguments);
  1469. }
  1470. return closeTab;
  1471. }(),
  1472. // 关闭多个页签
  1473. closeMulti: function () {
  1474. var _closeMulti = _asyncToGenerator(
  1475. /*#__PURE__*/
  1476. regenerator_default.a.mark(function _callee4(tabs) {
  1477. var _this4 = this;
  1478. var items, $router, contextmenu, nextTab, _iteratorNormalCompletion, _didIteratorError, _iteratorError, _iterator, _step, id;
  1479. return regenerator_default.a.wrap(function _callee4$(_context4) {
  1480. while (1) {
  1481. switch (_context4.prev = _context4.next) {
  1482. case 0:
  1483. items = this.items, $router = this.$router, contextmenu = this.contextmenu;
  1484. nextTab = items.find(function (_ref10) {
  1485. var id = _ref10.id;
  1486. return id === contextmenu.id;
  1487. });
  1488. _iteratorNormalCompletion = true;
  1489. _didIteratorError = false;
  1490. _iteratorError = undefined;
  1491. _context4.prev = 5;
  1492. _iterator = tabs[Symbol.iterator]();
  1493. case 7:
  1494. if (_iteratorNormalCompletion = (_step = _iterator.next()).done) {
  1495. _context4.next = 19;
  1496. break;
  1497. }
  1498. id = _step.value.id;
  1499. _context4.prev = 9;
  1500. _context4.next = 12;
  1501. return this.removeTab(id);
  1502. case 12:
  1503. _context4.next = 16;
  1504. break;
  1505. case 14:
  1506. _context4.prev = 14;
  1507. _context4.t0 = _context4["catch"](9);
  1508. case 16:
  1509. _iteratorNormalCompletion = true;
  1510. _context4.next = 7;
  1511. break;
  1512. case 19:
  1513. _context4.next = 25;
  1514. break;
  1515. case 21:
  1516. _context4.prev = 21;
  1517. _context4.t1 = _context4["catch"](5);
  1518. _didIteratorError = true;
  1519. _iteratorError = _context4.t1;
  1520. case 25:
  1521. _context4.prev = 25;
  1522. _context4.prev = 26;
  1523. if (!_iteratorNormalCompletion && _iterator.return != null) {
  1524. _iterator.return();
  1525. }
  1526. case 28:
  1527. _context4.prev = 28;
  1528. if (!_didIteratorError) {
  1529. _context4.next = 31;
  1530. break;
  1531. }
  1532. throw _iteratorError;
  1533. case 31:
  1534. return _context4.finish(28);
  1535. case 32:
  1536. return _context4.finish(25);
  1537. case 33:
  1538. // 当前页签如已关闭,则打开右键选中页签
  1539. if (items.findIndex(function (_ref11) {
  1540. var id = _ref11.id;
  1541. return id === _this4.activedTab;
  1542. }) === -1) {
  1543. $router.replace(nextTab.to);
  1544. }
  1545. case 34:
  1546. case "end":
  1547. return _context4.stop();
  1548. }
  1549. }
  1550. }, _callee4, this, [[5, 21, 25, 33], [9, 14], [26,, 28, 32]]);
  1551. }));
  1552. function closeMulti(_x2) {
  1553. return _closeMulti.apply(this, arguments);
  1554. }
  1555. return closeMulti;
  1556. }(),
  1557. // 通过路由地址刷新页签
  1558. refresh: function refresh(location) {
  1559. var fullMatch = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
  1560. if (location) {
  1561. var id = this.getIdByLocation(location, fullMatch);
  1562. if (id) {
  1563. this.refreshTab(id);
  1564. }
  1565. } else {
  1566. this.refreshTab();
  1567. }
  1568. },
  1569. // 刷新指定页签
  1570. refreshTab: function () {
  1571. var _refreshTab = _asyncToGenerator(
  1572. /*#__PURE__*/
  1573. regenerator_default.a.mark(function _callee5() {
  1574. var id,
  1575. _args5 = arguments;
  1576. return regenerator_default.a.wrap(function _callee5$(_context5) {
  1577. while (1) {
  1578. switch (_context5.prev = _context5.next) {
  1579. case 0:
  1580. id = _args5.length > 0 && _args5[0] !== undefined ? _args5[0] : this.activedTab;
  1581. _context5.prev = 1;
  1582. _context5.next = 4;
  1583. return this.pageLeavePromise(id, 'refresh');
  1584. case 4:
  1585. this.$refs.routerAlive.clear(id);
  1586. if (id === this.activedTab) this.reloadRouter();
  1587. _context5.next = 10;
  1588. break;
  1589. case 8:
  1590. _context5.prev = 8;
  1591. _context5.t0 = _context5["catch"](1);
  1592. case 10:
  1593. case "end":
  1594. return _context5.stop();
  1595. }
  1596. }
  1597. }, _callee5, this, [[1, 8]]);
  1598. }));
  1599. function refreshTab() {
  1600. return _refreshTab.apply(this, arguments);
  1601. }
  1602. return refreshTab;
  1603. }(),
  1604. /**
  1605. * 刷新所有页签
  1606. * @param {boolean} [force=false] 是否强制刷新,如果强制则忽略页面beforePageLeave
  1607. */
  1608. refreshAll: function () {
  1609. var _refreshAll = _asyncToGenerator(
  1610. /*#__PURE__*/
  1611. regenerator_default.a.mark(function _callee6() {
  1612. var force,
  1613. $alive,
  1614. cache,
  1615. id,
  1616. _args6 = arguments;
  1617. return regenerator_default.a.wrap(function _callee6$(_context6) {
  1618. while (1) {
  1619. switch (_context6.prev = _context6.next) {
  1620. case 0:
  1621. force = _args6.length > 0 && _args6[0] !== undefined ? _args6[0] : false;
  1622. $alive = this.$refs.routerAlive;
  1623. cache = $alive.cache;
  1624. _context6.t0 = regenerator_default.a.keys(cache);
  1625. case 4:
  1626. if ((_context6.t1 = _context6.t0()).done) {
  1627. _context6.next = 20;
  1628. break;
  1629. }
  1630. id = _context6.t1.value;
  1631. if (force) {
  1632. _context6.next = 17;
  1633. break;
  1634. }
  1635. _context6.prev = 7;
  1636. _context6.next = 10;
  1637. return this.pageLeavePromise(id, 'refresh');
  1638. case 10:
  1639. $alive.clear(id);
  1640. _context6.next = 15;
  1641. break;
  1642. case 13:
  1643. _context6.prev = 13;
  1644. _context6.t2 = _context6["catch"](7);
  1645. case 15:
  1646. _context6.next = 18;
  1647. break;
  1648. case 17:
  1649. $alive.clear(id);
  1650. case 18:
  1651. _context6.next = 4;
  1652. break;
  1653. case 20:
  1654. this.reloadRouter();
  1655. case 21:
  1656. case "end":
  1657. return _context6.stop();
  1658. }
  1659. }
  1660. }, _callee6, this, [[7, 13]]);
  1661. }));
  1662. function refreshAll() {
  1663. return _refreshAll.apply(this, arguments);
  1664. }
  1665. return refreshAll;
  1666. }(),
  1667. // 重载路由组件
  1668. reloadRouter: function () {
  1669. var _reloadRouter = _asyncToGenerator(
  1670. /*#__PURE__*/
  1671. regenerator_default.a.mark(function _callee7() {
  1672. var ignoreTransition,
  1673. _args7 = arguments;
  1674. return regenerator_default.a.wrap(function _callee7$(_context7) {
  1675. while (1) {
  1676. switch (_context7.prev = _context7.next) {
  1677. case 0:
  1678. ignoreTransition = _args7.length > 0 && _args7[0] !== undefined ? _args7[0] : false;
  1679. this.isRouterAlive = false; // 默认在页面过渡结束后会设置 isRouterAlive 为 true
  1680. // 如果过渡事件失效,则需传入 ignoreTransition 为 true 手动更改
  1681. if (!ignoreTransition) {
  1682. _context7.next = 6;
  1683. break;
  1684. }
  1685. _context7.next = 5;
  1686. return this.$nextTick();
  1687. case 5:
  1688. this.isRouterAlive = true;
  1689. case 6:
  1690. case "end":
  1691. return _context7.stop();
  1692. }
  1693. }
  1694. }, _callee7, this);
  1695. }));
  1696. function reloadRouter() {
  1697. return _reloadRouter.apply(this, arguments);
  1698. }
  1699. return reloadRouter;
  1700. }(),
  1701. // 页签过渡结束
  1702. onTabTransitionEnd: function onTabTransitionEnd() {
  1703. this.adjust();
  1704. },
  1705. // 页面过渡结束
  1706. onPageTransitionEnd: function onPageTransitionEnd() {
  1707. if (!this.isRouterAlive) this.isRouterAlive = true;
  1708. },
  1709. // 显示页签右键菜单
  1710. showContextmenu: function showContextmenu(id, index, e) {
  1711. // 菜单定位
  1712. var _ref12 = e || emptyObj,
  1713. top = _ref12.y,
  1714. left = _ref12.x;
  1715. Object.assign(this.contextmenu, {
  1716. id: id,
  1717. index: index,
  1718. top: top,
  1719. left: left
  1720. });
  1721. },
  1722. // 关闭页签右键菜单
  1723. hideContextmenu: function hideContextmenu() {
  1724. this.showContextmenu(null, -1);
  1725. },
  1726. // Tab滚动
  1727. tabScroll: function tabScroll(direction) {
  1728. var $tab = this.$el.querySelector('.router-tab-header');
  1729. var $scr = $tab.querySelector('.router-tab-scroll');
  1730. var space = $tab.clientWidth - 110;
  1731. scrollTo($scr, $scr.scrollLeft + (direction === 'left' ? -space : space));
  1732. },
  1733. // 调整Tab滚动显示
  1734. adjust: function adjust() {
  1735. var $tab = this.$el.querySelector('.router-tab-header');
  1736. var $scr = $tab.querySelector('.router-tab-scroll');
  1737. var $nav = $scr.querySelector('.router-tab-nav');
  1738. var $cur = $nav.querySelector('.actived');
  1739. var isScroll = $nav.clientWidth > $scr.clientWidth; // 判断是否需要滚动
  1740. $tab.classList[isScroll ? 'add' : 'remove']('is-scroll');
  1741. if ($cur && isScroll) {
  1742. scrollTo($scr, $cur.offsetLeft + ($cur.clientWidth - $scr.clientWidth) / 2);
  1743. }
  1744. },
  1745. // 修复:当快速频繁切换页签时,旧页面离开过渡效果尚未完成,新页面内容无法正常mount,内容节点为comment类型
  1746. fixCommentPage: function fixCommentPage() {
  1747. if (this.$refs.routerAlive.$el.nodeType === 8) {
  1748. this.reloadRouter(true);
  1749. }
  1750. }
  1751. }
  1752. });
  1753. // CONCATENATED MODULE: ./src/lib/RouterTab/components/RouterTab.js?vue&type=script&lang=js&
  1754. /* harmony default export */ var components_RouterTabvue_type_script_lang_js_ = (RouterTabvue_type_script_lang_js_);
  1755. // EXTERNAL MODULE: ./src/lib/RouterTab/scss/RouterTab.scss?vue&type=style&index=0&lang=scss&
  1756. var RouterTabvue_type_style_index_0_lang_scss_ = __webpack_require__("f143");
  1757. // EXTERNAL MODULE: ./src/lib/RouterTab/scss/transition.scss?vue&type=style&index=1&lang=scss&
  1758. var transitionvue_type_style_index_1_lang_scss_ = __webpack_require__("d8de");
  1759. // CONCATENATED MODULE: ./node_modules/@vue/cli-service/node_modules/vue-loader/lib/runtime/componentNormalizer.js
  1760. /* globals __VUE_SSR_CONTEXT__ */
  1761. // IMPORTANT: Do NOT use ES2015 features in this file (except for modules).
  1762. // This module is a runtime utility for cleaner component module output and will
  1763. // be included in the final webpack user bundle.
  1764. function normalizeComponent (
  1765. scriptExports,
  1766. render,
  1767. staticRenderFns,
  1768. functionalTemplate,
  1769. injectStyles,
  1770. scopeId,
  1771. moduleIdentifier, /* server only */
  1772. shadowMode /* vue-cli only */
  1773. ) {
  1774. // Vue.extend constructor export interop
  1775. var options = typeof scriptExports === 'function'
  1776. ? scriptExports.options
  1777. : scriptExports
  1778. // render functions
  1779. if (render) {
  1780. options.render = render
  1781. options.staticRenderFns = staticRenderFns
  1782. options._compiled = true
  1783. }
  1784. // functional template
  1785. if (functionalTemplate) {
  1786. options.functional = true
  1787. }
  1788. // scopedId
  1789. if (scopeId) {
  1790. options._scopeId = 'data-v-' + scopeId
  1791. }
  1792. var hook
  1793. if (moduleIdentifier) { // server build
  1794. hook = function (context) {
  1795. // 2.3 injection
  1796. context =
  1797. context || // cached call
  1798. (this.$vnode && this.$vnode.ssrContext) || // stateful
  1799. (this.parent && this.parent.$vnode && this.parent.$vnode.ssrContext) // functional
  1800. // 2.2 with runInNewContext: true
  1801. if (!context && typeof __VUE_SSR_CONTEXT__ !== 'undefined') {
  1802. context = __VUE_SSR_CONTEXT__
  1803. }
  1804. // inject component styles
  1805. if (injectStyles) {
  1806. injectStyles.call(this, context)
  1807. }
  1808. // register component module identifier for async chunk inferrence
  1809. if (context && context._registeredComponents) {
  1810. context._registeredComponents.add(moduleIdentifier)
  1811. }
  1812. }
  1813. // used by ssr in case component is cached and beforeCreate
  1814. // never gets called
  1815. options._ssrRegister = hook
  1816. } else if (injectStyles) {
  1817. hook = shadowMode
  1818. ? function () { injectStyles.call(this, this.$root.$options.shadowRoot) }
  1819. : injectStyles
  1820. }
  1821. if (hook) {
  1822. if (options.functional) {
  1823. // for template-only hot-reload because in that case the render fn doesn't
  1824. // go through the normalizer
  1825. options._injectStyles = hook
  1826. // register for functioal component in vue file
  1827. var originalRender = options.render
  1828. options.render = function renderWithStyleInjection (h, context) {
  1829. hook.call(context)
  1830. return originalRender(h, context)
  1831. }
  1832. } else {
  1833. // inject component registration as beforeCreate hook
  1834. var existing = options.beforeCreate
  1835. options.beforeCreate = existing
  1836. ? [].concat(existing, hook)
  1837. : [hook]
  1838. }
  1839. }
  1840. return {
  1841. exports: scriptExports,
  1842. options: options
  1843. }
  1844. }
  1845. // CONCATENATED MODULE: ./src/lib/RouterTab/components/RouterTab.vue
  1846. /* normalize component */
  1847. var component = normalizeComponent(
  1848. components_RouterTabvue_type_script_lang_js_,
  1849. RouterTabvue_type_template_id_6424321e_render,
  1850. staticRenderFns,
  1851. false,
  1852. null,
  1853. null,
  1854. null
  1855. )
  1856. /* harmony default export */ var RouterTab = (component.exports);
  1857. // CONCATENATED MODULE: ./src/lib/RouterTab/index.js
  1858. // 安装
  1859. RouterTab.install = function install(Vue, options) {
  1860. if (install.installed) return;
  1861. install.installed = true;
  1862. Vue.component(RouterTab.name, RouterTab);
  1863. Vue.mixin(RouterPage);
  1864. }; // 如果浏览器环境且拥有全局Vue,则自动安装组件
  1865. if (typeof window !== 'undefined' && window.Vue) {
  1866. window.Vue.use(RouterTab);
  1867. }
  1868. /* harmony default export */ var lib_RouterTab = (RouterTab);
  1869. // CONCATENATED MODULE: ./node_modules/@vue/cli-service/lib/commands/build/entry-lib.js
  1870. /* harmony default export */ var entry_lib = __webpack_exports__["default"] = (lib_RouterTab);
  1871. /***/ })
  1872. /******/ });
  1873. //# sourceMappingURL=vue-router-tab.common.js.map