diff --git a/src/nav-bar/index.js b/src/nav-bar/index.js
index ab3ec7045..24eeb92b1 100644
--- a/src/nav-bar/index.js
+++ b/src/nav-bar/index.js
@@ -67,19 +67,27 @@ export default createComponent({
style={{ zIndex: this.zIndex }}
class={[bem({ fixed: this.fixed }), { [BORDER_BOTTOM]: this.border }]}
>
-
+ {this.hasLeft() &&
{this.genLeft()}
-
+
}
{this.slots('title') || this.title}
-
+ {this.hasRight() &&
{this.genRight()}
-
+
}
);
},
+ hasLeft() {
+ return this.leftArrow || this.leftText || this.slots('left');
+ },
+
+ hasRight() {
+ return this.rightText || this.slots('right');
+ },
+
onClickLeft(event) {
this.$emit('click-left', event);
},
diff --git a/src/nav-bar/test/__snapshots__/index.spec.js.snap b/src/nav-bar/test/__snapshots__/index.spec.js.snap
index 263a07ecc..d4f4630a6 100644
--- a/src/nav-bar/test/__snapshots__/index.spec.js.snap
+++ b/src/nav-bar/test/__snapshots__/index.spec.js.snap
@@ -3,9 +3,7 @@
exports[`placeholder prop 1`] = `
`;
@@ -20,8 +18,6 @@ exports[`render left & right slot 1`] = `
exports[`render title slot 1`] = `
`;