[new feature] Tab: add line height prop (#2357)
This commit is contained in:
@@ -112,9 +112,9 @@
|
||||
z-index: 1;
|
||||
left: 0;
|
||||
bottom: 15px;
|
||||
height: 2px;
|
||||
height: 3px;
|
||||
position: absolute;
|
||||
border-radius: 2px;
|
||||
border-radius: 3px;
|
||||
background-color: @red;
|
||||
}
|
||||
|
||||
|
||||
+15
-2
@@ -85,6 +85,10 @@ export default create({
|
||||
type: Number,
|
||||
default: null
|
||||
},
|
||||
lineHeight: {
|
||||
type: Number,
|
||||
default: null
|
||||
},
|
||||
active: {
|
||||
type: [Number, String],
|
||||
default: 0
|
||||
@@ -298,15 +302,24 @@ export default create({
|
||||
}
|
||||
|
||||
const tab = tabs[this.curActive];
|
||||
const width = this.isDef(this.lineWidth) ? this.lineWidth : (tab.offsetWidth / 2);
|
||||
const { lineWidth, lineHeight } = this;
|
||||
const width = this.isDef(lineWidth) ? lineWidth : (tab.offsetWidth / 2);
|
||||
const left = tab.offsetLeft + (tab.offsetWidth - width) / 2;
|
||||
|
||||
this.lineStyle = {
|
||||
const lineStyle = {
|
||||
width: `${width}px`,
|
||||
backgroundColor: this.color,
|
||||
transform: `translateX(${left}px)`,
|
||||
transitionDuration: `${this.duration}s`
|
||||
};
|
||||
|
||||
if (this.isDef(lineHeight)) {
|
||||
const height = `${lineHeight}px`;
|
||||
lineStyle.height = height;
|
||||
lineStyle.borderRadius = height;
|
||||
}
|
||||
|
||||
this.lineStyle = lineStyle;
|
||||
});
|
||||
},
|
||||
|
||||
|
||||
Reference in New Issue
Block a user