页面重新加载,tabs选中tab的下划线不显示,如图所示:
和点击后的效果,如下,是不一样的
computed: {
barStyle: {
get: function get() {
var _this = this;
var style = {};
var offset = 0;
var tabSize = 0;
var sizeName = ['top', 'bottom'].indexOf(this.rootTabs.tabPosition) !== -1 ? 'width' : 'height';
var sizeDir = sizeName === 'width' ? 'x' : 'y';
var firstUpperCase = function firstUpperCase(str) {
return str.toLowerCase().replace(/( |^)[a-z]/g, function (L) {
return L.toUpperCase();
});
};
this.tabs.every(function (tab, index) {
var $el = Object(util_["arrayFind"])(_this.$parent.$refs.tabs || [], function (t) {
return t.id.replace('tab-', '') === tab.paneName;
});
if (!$el) {
return false;
}
if (!tab.active) {
offset += $el['client' + firstUpperCase(sizeName)];
return true;
} else {
tabSize = $el['client' + firstUpperCase(sizeName)];
if (sizeName === 'width' && _this.tabs.length > 1) {
tabSize -= index === 0 || index === _this.tabs.length - 1 ? 20 : 40;
}
return false;
}
});
经过跟踪element tab的代码,发现这里tab对应的clientWidth 为0,如果是通过点击方式,clientWidth是有值的。请问一下,是什么原因导致的这个问题?
export default {
data () {
return {
activeName: 'changeInformation'
}
},