-
+
@@ -30,11 +35,6 @@
type: {
type: String,
default: 'line'
- },
- // nav的wrap的样式
- navclass: {
- type: String,
- default: ''
}
},
@@ -42,27 +42,28 @@
return {
tabs: [],
isReady: false,
- switchActiveTabKey: +this.active
+ curActive: +this.active
};
},
watch: {
active(val) {
- this.switchActiveTabKey = +val;
+ this.curActive = +val;
}
},
computed: {
- classNames() {
- return [`zan-tabs__nav--${this.type}`, `zan-tabs--col-${this.tabs.length}`, this.navclass];
- },
-
+ /**
+ * `type`为`line`时,tab下方的横线的样式
+ */
navBarStyle() {
- if (!this.isReady) return;
- const tabKey = this.switchActiveTabKey;
+ if (!this.isReady || type !== 'line') return;
+
+ const tabKey = this.curActive;
const elem = this.$refs.tabkey[tabKey];
const offsetWidth = `${elem.offsetWidth || 0}px`;
const offsetLeft = `${elem.offsetLeft || 0}px`;
+
return {
width: offsetWidth,
transform: `translate3d(${offsetLeft}, 0px, 0px)`
@@ -71,13 +72,20 @@
},
methods: {
+ /**
+ * tab点击事件
+ *
+ * @param {number} index tab在tabs中的索引
+ * @param {Object} el tab的vue实例
+ */
handleTabClick(index, el) {
- if (el.disable) {
- el.$emit('disable');
+ if (el.disabled) {
+ el.$emit('disabled', index);
return;
}
+
this.$emit('click', index);
- this.switchActiveTabKey = index;
+ this.curActive = index;
}
},
diff --git a/packages/zanui-css/scripts/build.sh b/packages/zanui-css/scripts/build.sh
index d2aa91528..5d3ca5d89 100644
--- a/packages/zanui-css/scripts/build.sh
+++ b/packages/zanui-css/scripts/build.sh
@@ -14,7 +14,7 @@ command_exists () {
fontname() {
if command_exists superman ; then
- echo "//b.yzcdn.cn$server_prefix/$(basename $basepath/../build/font/zanui-icon-*.$1)"
+ echo "https://b.yzcdn.cn$server_prefix/$(basename $basepath/../build/font/zanui-icon-*.$1)"
else
echo "$(abspath $basepath/../build/font/zanui-icon-*.$1)"
fi
diff --git a/packages/zanui-css/src/tab.css b/packages/zanui-css/src/tab.css
index bc552a6be..b3fe3896a 100644
--- a/packages/zanui-css/src/tab.css
+++ b/packages/zanui-css/src/tab.css
@@ -53,9 +53,7 @@
border-radius: 2px;
border: 1px solid #666666;
overflow: hidden;
- .zan-tabs__nav-bar {
- display: none;
- }
+
.zan-tab {
color: #666666;
line-height: 28px;