vue-router-tab.umd.js 75 KB

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