From 632cfbcf362101de9c02654e65077d44a20156ba Mon Sep 17 00:00:00 2001 From: neverland Date: Fri, 15 Feb 2019 19:28:20 +0800 Subject: [PATCH] =?UTF-8?q?[new=20feature]=20Button:=20add=20url=E3=80=81t?= =?UTF-8?q?o=E3=80=81replace=20prop=20(#2754)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- packages/button/en-US.md | 3 +++ packages/button/index.js | 3 +++ packages/button/zh-CN.md | 4 +++- 3 files changed, 9 insertions(+), 1 deletion(-) diff --git a/packages/button/en-US.md b/packages/button/en-US.md index 9f5e04b89..9d5d1a2fd 100644 --- a/packages/button/en-US.md +++ b/packages/button/en-US.md @@ -71,6 +71,9 @@ Vue.use(Button); | disabled | Whether to disable button | `Boolean` | `false` | | loading | Whether show loading status | `Boolean` | `false` | | loading-text | Loading text | `String` | - | +| url | Link URL | `String` | - | +| to | Target route of the link, same as to of `vue-router` | `String | Object` | - | +| replace | If true, the navigation will not leave a history record | `String` | `false` | ### Event diff --git a/packages/button/index.js b/packages/button/index.js index f46cd3486..f5a738759 100644 --- a/packages/button/index.js +++ b/packages/button/index.js @@ -1,5 +1,6 @@ import { use } from '../utils'; import { emit, inherit } from '../utils/functional'; +import { routeProps, functionalRoute } from '../mixins/router'; import Loading from '../loading'; const [sfc, bem] = use('button'); @@ -10,6 +11,7 @@ function Button(h, props, slots, ctx) { const onClick = event => { if (!loading && !disabled) { emit(ctx, 'click', event); + functionalRoute(ctx); } }; @@ -48,6 +50,7 @@ function Button(h, props, slots, ctx) { } Button.props = { + ...routeProps, text: String, block: Boolean, plain: Boolean, diff --git a/packages/button/zh-CN.md b/packages/button/zh-CN.md index fd030304c..3a20d5868 100644 --- a/packages/button/zh-CN.md +++ b/packages/button/zh-CN.md @@ -61,7 +61,6 @@ Vue.use(Button); 迷你按钮 ``` - ### API | 参数 | 说明 | 类型 | 默认值 | 版本 | @@ -78,6 +77,9 @@ Vue.use(Button); | disabled | 是否禁用按钮 | `Boolean` | `false` | - | | loading | 是否显示为加载状态 | `Boolean` | `false` | - | | loading-text | 加载状态提示文字 | `String` | - | 1.6.3 | +| url | 跳转链接 | `String` | - | 1.6.5 | +| to | 路由跳转对象,同 `vue-router` 的 to | `String | Object` | - | 1.6.5 | +| replace | 跳转时是否替换当前页面历史 | `String` | `false` | 1.6.5 | ### Event