{{ tab.title }}
@@ -21,41 +21,36 @@
name: 'zan-tabs',
props: {
// 外部传入的激活的tab标签
- activeTabKey: {
+ active: {
type: [Number, String],
default: 0
},
// 是默认的line还是card
- classType: {
+ classtype: {
type: String,
default: 'line'
},
// nav的wrap的样式
- tabsClassName: {
+ classname: {
type: String,
default: ''
- },
- // 每个nav里tab的样式
- tabClassName: {
- type: String
}
},
data() {
return {
tabs: [],
isReady: false,
- switchActiveTabKey: this.activeTabKey
+ switchActiveTabKey: this.active
};
},
computed: {
classNames () {
- return [ `zan-tabs-${this.classType}`, this.tabsClassName ]
+ return [ `zan-tabs-${this.classtype}`, this.classname ]
},
navBarStyle () {
if(!this.isReady) return;
let tabKey = this.switchActiveTabKey;
- let selectors = `.J-tab-key[data-key="${tabKey}"]`;
- let elem = this.$el.querySelector(selectors) || {};
+ let elem = this.$refs.tabkey[tabKey];
let w = `${elem.offsetWidth || 0}px`;
let x = `${elem.offsetLeft || 0}px`;
return {
@@ -65,14 +60,12 @@
}
},
methods: {
- tabCreate (tabKey, title) {
- this.tabs.push({
- tabKey: tabKey,
- title: title
- });
- },
- handleTabClick(tabKey) {
- this.switchActiveTabKey = tabKey;
+ handleTabClick(index, el) {
+ if(el.disable) {
+ el.$emit('ondisable');
+ return
+ }
+ this.switchActiveTabKey = index;
}
},
mounted () {
diff --git a/src/index.js b/src/index.js
index 4503f31bd..71103a6fb 100644
--- a/src/index.js
+++ b/src/index.js
@@ -23,6 +23,7 @@ import Search from '../packages/search/index.js';
import Step from '../packages/step/index.js';
import Tabs from '../packages/tabs/index.js';
import Tab from '../packages/tab/index.js';
+import Lazyload from '../packages/lazyload/index.js';
import ImagePreview from '../packages/image-preview/index.js';
import Col from '../packages/col/index.js';
import Row from '../packages/row/index.js';
@@ -92,6 +93,7 @@ module.exports = {
Step,
Tabs,
Tab,
+ Lazyload,
ImagePreview,
Col,
Row,