vant/docs/markdown/zh-CN/nav-bar.md
neverland 03aef579ad
[bugfix] NavBar click event (#354)
* fix: Tabbar icon line-height

* [new feature] progress add showPivot prop

* [new feature] TabItem support vue-router

* [new feature] update document header style

* [Doc] add toast english ducoment

* [bugfix] Search box-sizing wrong

* [Doc] update vant-demo respo

* [Doc] translate theme & demo pages

* [Doc] add Internationalization document

* [bugfix] remove unnecessary props

* [fix] optimize clickoutside

* [new feature] optimize find-parent

* [new feature]: change document title accordinng to language

* [new feature] Pagination code review

* [improvement] adjust icon-font unicode

* [improvement] Icon spinner color inherit

* [improvement] icon default width

* [bugfix] DateTimePicker validate date props

* [bugfix] Tab item text ellipsis

* [improvement] optimize single line ellipsis

* [Improvement] optimzie staticClass

* [Improvement] Button: use sfc instread of jsx

* [Improvement] update actionsheet close icon style

* fix: yarn.lock

* fix: icon test cases

* [bugfix] errors during ssr

* [Improvement] SubmitBar add left slot

* [new feature] ImagePreview support manually close

* fix: ImagePreview test case

* [Doc] add switch lang button in mobile

* [bugfix] Popup overlay style update

* [bugfix] NavBar click event
2017-11-27 10:52:26 +08:00

71 lines
1.3 KiB
Markdown

## NavBar 导航栏
### 使用指南
``` javascript
import { NavBar } from 'vant';
Vue.component(NavBar.name, NavBar);
```
### 代码演示
#### 基础用法
```html
<van-nav-bar
title="标题"
leftText="返回"
rightText="按钮"
leftArrow
@click-left="onClickLeft"
@click-right="onClickRight"
/>
```
```js
export default {
methods: {
onClickLeft() {
Toast('返回');
},
onClickRight() {
Toast('按钮');
}
}
}
```
#### 高级用法
通过 slot 定制内容
```html
<van-nav-bar title="标题" leftText="返回" leftArrow>
<van-icon name="search" slot="right" />
</van-nav-bar>
```
### API
| 参数 | 说明 | 类型 | 默认值 | 可选值 |
|-----------|-----------|-----------|-------------|-------------|
| title | 标题 | `String` | `''` | - |
| leftText | 左侧文案 | `String` | `''` | - |
| rightText | 右侧文案 | `String` | `''` | - |
| leftArrow | 是否显示左侧箭头 | `Boolean` | `false` | - |
| fixed | 是否固定在顶部 | `Boolean` | `false` | - |
### Slot
| name | 描述 |
|-----------|-----------|
| title | 自定义标题 |
| left | 自定义左侧区域内容 |
| right | 自定义右侧区域内容 |
### Event
| 事件名 | 说明 | 参数 |
|-----------|-----------|-----------|
| click-left | 点击左侧按钮时触发 | - |
| click-right | 点击右侧按钮时触发 | - |