Răsfoiți Sursa

优化:uview的tab组件支持设置item样式

萤火科技 1 an în urmă
părinte
comite
0cde8cf055
1 a modificat fișierele cu 9 adăugiri și 1 ștergeri
  1. 9 1
      uni_modules/vk-uview-ui/components/u-tabs/u-tabs.vue

+ 9 - 1
uni_modules/vk-uview-ui/components/u-tabs/u-tabs.vue

@@ -143,6 +143,13 @@
 				type: Boolean,
 				default: true
 			},
+			// tab item的样式
+			itemStyle: {
+				type: Object,
+				default() {
+					return {}
+				}
+			},
 			// 当前活动tab item的样式
 			activeItemStyle: {
 				type: Object,
@@ -254,9 +261,10 @@
 					if (index == this.currentIndex) {
 						style.color = this.activeColor;
 						// 给选中的tab item添加外部自定义的样式
-						style = Object.assign(style, this.activeItemStyle);
+						style = Object.assign(style, this.itemStyle, this.activeItemStyle, { color: this.activeColor });
 					} else {
 						style.color = this.inactiveColor;
+						style = Object.assign(style, this.itemStyle);
 					}
 					return style;
 				}