diff --git a/@types/nav-bar.d.ts b/@types/nav-bar.d.ts index f027c68ba..9090ecca7 100644 --- a/@types/nav-bar.d.ts +++ b/@types/nav-bar.d.ts @@ -10,6 +10,8 @@ export interface AtNavBarProps extends AtComponent{ fixed?: boolean + border?: boolean + color?: string leftIconType?: string diff --git a/docs/markdown/navbar.md b/docs/markdown/navbar.md index 7898798e4..a1459df02 100644 --- a/docs/markdown/navbar.md +++ b/docs/markdown/navbar.md @@ -40,6 +40,7 @@ import { AtNavBar } from 'taro-ui' | ---------- | -------------------------------------- | ------- | ------------------------------------------------------------------- | -------- | | color | 链接文字跟图标颜色,不包括标题 | Number | - | `#6190E8` | | fixed | 是否固定顶部 | Boolean | - | false | +| border | 是否显示下划线(v1.4.0 新增) | Boolean | - | true | | leftIconType | 左边图标类型,图标类型请看`AtIcon`文档 | String | - | 'chevron-left' | | leftText | 左边文字 | String | - | - | | title | 标题文字 | String | - | - | diff --git a/src/components/nav-bar/index.js b/src/components/nav-bar/index.js index b1f05fb9c..48a69f024 100644 --- a/src/components/nav-bar/index.js +++ b/src/components/nav-bar/index.js @@ -14,6 +14,7 @@ export default class AtNavBar extends AtComponent { customStyle: '', className: '', fixed: false, + border: true, color: '#6190E8', leftIconType: '', leftText: '', @@ -35,6 +36,7 @@ export default class AtNavBar extends AtComponent { PropTypes.string ]), fixed: PropTypes.bool, + border: PropTypes.bool, color: PropTypes.string, leftIconType: PropTypes.string, leftText: PropTypes.string, @@ -64,6 +66,7 @@ export default class AtNavBar extends AtComponent { className, color, fixed, + border, leftIconType, leftText, title, @@ -76,7 +79,8 @@ export default class AtNavBar extends AtComponent { className={ classNames({ 'at-nav-bar': true, - 'at-nav-bar--fixed': fixed + 'at-nav-bar--fixed': fixed, + 'at-nav-bar--no-border': !border }, className) } style={customStyle} diff --git a/src/components/nav-bar/index.scss b/src/components/nav-bar/index.scss index 98d1b974a..9182dac18 100644 --- a/src/components/nav-bar/index.scss +++ b/src/components/nav-bar/index.scss @@ -15,6 +15,12 @@ $font-size: 18PX; overflow: hidden; @include hairline-bottom(); + &--no-border { + &::after { + border-bottom-width: 0; + } + } + &--fixed { position: fixed; top: 0; diff --git a/src/pages/navigation/navbar/index.js b/src/pages/navigation/navbar/index.js index ce6336bba..59e8000e7 100644 --- a/src/pages/navigation/navbar/index.js +++ b/src/pages/navigation/navbar/index.js @@ -115,6 +115,24 @@ export default class Index extends Taro.Component { /> + + {/* 无下划线 */} + + 无下划线 + + + + )