mirror of
https://github.com/youzan/vant.git
synced 2025-10-22 20:04:09 +00:00
[Doc] Button: add route demo (#4068)
This commit is contained in:
@@ -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
|
||||
|
@@ -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
|
||||
|
@@ -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'
|
||||
}
|
||||
}
|
||||
};
|
||||
|
@@ -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>
|
||||
`;
|
||||
|
Reference in New Issue
Block a user