vue-router-tab.umd.js 75 KB

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