diff --git a/docs/component/tabs.md b/docs/component/tabs.md index ef2a37194..f9aab7813 100644 --- a/docs/component/tabs.md +++ b/docs/component/tabs.md @@ -263,6 +263,7 @@ function handlePopupShow() { | autoLineWidth | 底部条宽度跟随文字,指定`lineWidth`时此选项不生效 | boolean | - | false | 1.4.0 | | lineWidth | 底部条宽度,单位像素 | number | - | 19 | - | | lineHeight | 底部条高度,单位像素 | number | - | 3 | - | +| lineBgColor | 底部条颜色 | string | - | #4d80f0 | $LOWEST_VERSION$ | | color | 文字颜色 | string | - | - | - | | inactiveColor | 非活动标签文字颜色 | string | - | - | - | | animated | 是否开启切换标签内容时的转场动画 | boolean | - | false | - | diff --git a/src/uni_modules/wot-design-uni/components/wd-tabs/types.ts b/src/uni_modules/wot-design-uni/components/wd-tabs/types.ts index 7d4f1448d..2e18a4ad6 100644 --- a/src/uni_modules/wot-design-uni/components/wd-tabs/types.ts +++ b/src/uni_modules/wot-design-uni/components/wd-tabs/types.ts @@ -59,6 +59,10 @@ export const tabsProps = { * 底部条高度,单位像素 */ lineHeight: numericProp, + /** + * 底部条颜色 + */ + lineBgColor: makeStringProp(''), /** * 颜色 */ diff --git a/src/uni_modules/wot-design-uni/components/wd-tabs/wd-tabs.vue b/src/uni_modules/wot-design-uni/components/wd-tabs/wd-tabs.vue index 80cf1d13d..d7cfbe025 100644 --- a/src/uni_modules/wot-design-uni/components/wd-tabs/wd-tabs.vue +++ b/src/uni_modules/wot-design-uni/components/wd-tabs/wd-tabs.vue @@ -308,7 +308,7 @@ function toggleMap() { */ async function updateLineStyle(animation: boolean = true) { if (!state.inited) return - const { autoLineWidth, lineWidth, lineHeight } = props + const { autoLineWidth, lineWidth, lineHeight, lineBgColor } = props try { const lineStyle: CSSProperties = {} if (isDef(lineWidth)) { @@ -320,6 +320,9 @@ async function updateLineStyle(animation: boolean = true) { lineStyle.width = addUnit(textWidth) } } + if (isDef(lineBgColor)) { + lineStyle.background = addUnit(lineBgColor) + } if (isDef(lineHeight)) { lineStyle.height = addUnit(lineHeight) lineStyle.borderRadius = `calc(${addUnit(lineHeight)} / 2)`