[Doc] Button: add route demo (#4068)

This commit is contained in:
neverland
2019-08-08 19:25:56 +08:00
committed by GitHub
parent bc4323b128
commit 09c618d475
8 changed files with 54 additions and 14 deletions

View File

@@ -73,6 +73,13 @@ Vue.use(Button);
<van-button type="primary" size="mini">Mini</van-button>
```
### Route
```html
<van-button type="primary" url="//youzan.github.io/vant/mobile.html">URL</van-button>
<van-button type="primary" to="index">Vue Router</van-button>
```
## API
### Props

View File

@@ -89,6 +89,15 @@ Vue.use(Button);
<van-button type="primary" size="mini">迷你按钮</van-button>
```
### 页面导航
可以通过`url`属性进行 URL 跳转,或通过`to`属性进行路由跳转
```html
<van-button type="primary" url="//youzan.github.io/vant/mobile.html">URL 跳转</van-button>
<van-button type="primary" to="index">路由跳转</van-button>
```
## API
### Props

View File

@@ -125,6 +125,19 @@
{{ $t('mini') }}
</van-button>
</demo-block>
<demo-block :title="$t('router')">
<van-button
:text="$t('urlRoute')"
type="primary"
url="//youzan.github.io/vant/mobile.html"
/>
<van-button
:text="$t('vueRoute')"
type="primary"
to="index"
/>
</demo-block>
</demo-section>
</template>
@@ -151,7 +164,10 @@ export default {
round: '圆形按钮',
hairline: '细边框',
hairlineButton: '细边框按钮',
loadingText: '加载中...'
loadingText: '加载中...',
router: '页面导航',
urlRoute: 'URL 跳转',
vueRoute: '路由跳转'
},
'en-US': {
type: 'Type',
@@ -173,7 +189,10 @@ export default {
round: 'Round',
hairline: 'Hairline',
hairlineButton: 'Hairline',
loadingText: 'Loading...'
loadingText: 'Loading...',
router: 'Router',
urlRoute: 'URL',
vueRoute: 'Vue Router'
}
}
};

View File

@@ -31,5 +31,6 @@ exports[`renders demo correctly 1`] = `
</span></button> <button class="van-button van-button--primary van-button--mini"><span class="van-button__text">
迷你按钮
</span></button></div>
<div><button class="van-button van-button--primary van-button--normal"><span class="van-button__text">URL 跳转</span></button> <button class="van-button van-button--primary van-button--normal"><span class="van-button__text">路由跳转</span></button></div>
</div>
`;