代码拉取完成,页面将自动刷新
同步操作将从 alex qian/vue-tab 强制同步,此操作会覆盖自 Fork 仓库以来所做的任何修改,且无法恢复!!!
确定后同步将在后台操作,完成时将刷新页面,请耐心等待。
/**
* vue-tabs v0.2.0
* (c) 2016 ALEXQDJAY
* mail: [email protected]
* @license Apache2
*/
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define(e):t.VueTaber=e()}(this,function(){"use strict";function t(t){return t?"function"==typeof t:!1}function e(t){return t?"string"==typeof t:!1}function n(t){return t?"[object Object]"===Object.prototype.toString.call(t):!1}function a(t,e){if(void 0===e&&(e=""),n(t)){var a=t.name,i=t.key;return void 0===i&&(i=""),a+"/"+i}return t+"/"+e}function i(t){i.installed||(i.installed=!0,Object.defineProperty(t.prototype,"$taber",{get:function(){return this.$root._taber}}),Object.defineProperty(t.prototype,"$tab",{get:function(){return this.$options.$tab}}),l.methods.getVue=function(){return t},t.component("VueTabs",l),t.mixin({beforeCreate:function(){this.$options.taber?this._taber=this.$options.taber:this.$options.__taber&&(this._taber=this.$options.__taber)}}))}var s={save:function(t,e){t&&e&&(window.localStorage[t]=JSON.stringify(e))},get:function(t){var e=window.localStorage[t];return e?JSON.parse(e):null}},o={STORE_KEY:"$TABS"},r={render:function(){var t=this,e=t.$createElement;return e("li",{"class":{active:t.tabData.active,loading:t.tabData.loading}},[t._s(t.tabData.meta.title),e("span",{staticClass:"btn-close",on:{click:function(e){e.stopPropagation(),t.close(e)}}},["×"])])},staticRenderFns:[],props:{tabData:Object},methods:{close:function(){this.$emit("close",this.tabData)}}},c="vue-tabs-active-change",u="vue-tabs-close",f={},l={render:function(){var t=this,e=t.$createElement;return e("div",{staticClass:"vue-tabs"},[e("div",{staticClass:"tabs-list-wrapper"},[e("ul",{staticClass:"tabs-list"},[t._l(t.tabs,function(n){return e("tab",{attrs:{"tab-data":n},on:{close:function(){t.close(n)}},nativeOn:{click:function(){t.clickTab(n)}}})})])])," ",e("div",{ref:"contentWrapEl",staticClass:"tabs-content-wrapper"})])},staticRenderFns:[],components:{Tab:r},data:function(){return{tabs:[],active:null}},beforeCreate:function(){this.tabSize=0,this.tabMap={}},created:function(){this.$taber.vm=this},mounted:function(){this.$taber.mounted()},methods:{appendContent:function(e){function n(t){var n=document.createElement("div");s.$refs.contentWrapEl.appendChild(n);var a=new t({el:n,__taber:s.$taber,parent:s,$tab:e});e.content=a,a.$el.classList.add("tabs-content")}var a,i=f[e.name],s=this;if(i)a=Promise.resolve(i);else if(t(e.meta.component)){var o=e.meta.component;this.$set(e,"loading",!0),a=new Promise(o).then(function(t){return f[e.name]=s.getVue().extend(t)})}else a=Promise.resolve(e.meta.component).then(function(t){return f[e.name]=s.getVue().extend(t)});return a.then(function(t){n(t)}),a},clickTab:function(t){t&&!t.active&&this.select(t)},close:function(e){function n(t){if(null==t)s[++o].call(r,e,n);else if(t===!1)return}function i(){e.content.$destroy(),e.content.$el.remove(),this.tabMap[a(e)]=null;var t=this.tabs.indexOf(e);-1!==t&&(this.tabs.splice(t,1),this.tabs.length>0&&this.active===e?this.select(t<this.tabs.length?this.tabs[t]:this.tabs[this.tabs.length-1]):0===this.tabs.length&&(this.$emit(c,null,e),this._saveTabs()),this.$emit(u,e))}if(e){var s=[].concat(this.$taber.beforeCloseHooks);e.meta.beforeClose&&t(e.meta.beforeClose)&&s.push(e.meta.beforeClose),s.push(i);var o=0,r=this;s[0].call(r,e,n)}},create:function(i){var s=this,o=[].concat(this.$taber.beforeCreateHooks);i.meta.beforeCreate&&t(i.meta.beforeCreate)&&o.push(i.meta.beforeCreate);var r=0,c=this,u=function(t){if(null==t)o[++r].call(c,i,u);else{if(t===!1)return;e(t)&&t===i.name?o[++r].call(c,i,u):n(t)&&t.name===i.name?o[++r].call(c,i,u):c.$taber.open(t)}};o.push(function(){s.tabs.push(i);var t=s.appendContent(i).then(function(){s.$set(i,"loading",!1)});i.promise=t,i.active!==!1?s.select(i):s._saveTabs();var e=a(i.name,i.key);s.tabMap[e]=i,u=null,o=null}),o[0].call(this,i,u)},findOpenTab:function(t,e){var n=a(t,e);return this.tabMap[n]},select:function(t){var e=this;if(t){this.$set(t,"active",!0),this.$emit(c,t,this.active),this.active=t,this.tabs.forEach(function(n){a(n.name,n.key)!==a(t.name,t.key)&&(e.$set(n,"active",!1),n.content&&n.content.$el&&n.content.$el.classList.remove("active"))}),this._saveTabs();var n=t.promise;n||(n=Promise.resolve()),n.then(function(){t.active&&t.content&&(t.content.$el.classList.add("active"),t.promise=null)})}},_saveTabs:function(){if(this.$taber.persist){var t=this.tabs.map(function(t){return{name:t.name,key:t.key,params:t.params,active:t.active}});s.save(o.STORE_KEY,t)}}}},h=["vue-tabs-close","vue-tabs-active-change"],p=function(t){var e=this,n=t.tabs,a=t.persist;this._tabsMap={},n.forEach(function(t){e._tabsMap[t.name]=t}),this.beforeCreateHooks=[],this.beforeCloseHooks=[],this._events={},this.persist=a},b={vm:{}};return p.prototype.findTab=function(t){if(!t)return null;var n;return n=e(t)?t:t.name,this._tabsMap[n]},p.prototype.open=function(t){e(t)&&(t={name:t});var n=this.findTab(t);if(!n)return void console.error("The Tab ["+t.name+"] is not defined!");t.meta=n;var a=this.vm.findOpenTab(t.name,t.key);a?this.vm.select(a):this.vm.create(t)},p.prototype.close=function(t){e(t)&&(t={name:t});var n=this.findTab(t);if(!n)return void console.error("The Tab ["+t.name+"] is not defined!");t.meta=n;var a=this.vm.findOpenTab(t.name,t.key);this.vm.close(a)},p.prototype.select=function(t){e(t)&&(t={name:t});var n=this.vm.findOpenTab(t.name,t.key);this.vm.select(n)},p.prototype.$on=function(e,n){return e&&t(n)?(this._events[e]||(this._events[e]=[]),void this._events[e].push(n)):void console.error("$on error event:["+e+"], call:"+n)},p.prototype.$off=function(t,e){if(t){var n=this._events[t]||[];if(e){var a=n.indexOf(e);-1!==a&&n.splice(a,1)}else this._events[t]=[]}},p.prototype.beforeCreateEach=function(e){t(e)&&this.beforeCreateHooks.push(e)},p.prototype.beforeCloseEach=function(e){t(e)&&this.beforeCloseHooks.push(e)},p.prototype._restoreTabs=function(){var t=this;if(this.persist){var e=s.get(o.STORE_KEY);e&&e.forEach(function(e){t.open(e)})}},p.prototype.mounted=function(){this._restoreTabs()},b.vm.set=function(t){var e=this;this._vm=t;var n=this;h.forEach(function(a){t.$on(a,function(){for(var t=[],i=arguments.length;i--;)t[i]=arguments[i];var s=e._events[a]||[];s.forEach(function(e){e.apply(n,t)})})})},b.vm.get=function(){return this._vm},Object.defineProperties(p.prototype,b),p.install=i,window.Vue&&window.Vue.use(p),p});
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。