From eb32c6b02ea43450b5828734043671c71f10e0e6 Mon Sep 17 00:00:00 2001 From: neverland Date: Wed, 11 Sep 2019 11:15:53 +0800 Subject: [PATCH] =?UTF-8?q?feat(Tab):=20add=20to=E3=80=81url=E3=80=81repla?= =?UTF-8?q?ce=20prop=20(#4422)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/button/README.zh-CN.md | 4 ++-- src/card/README.zh-CN.md | 2 +- src/cell/README.zh-CN.md | 4 ++-- src/goods-action/README.zh-CN.md | 8 ++++---- src/grid/README.zh-CN.md | 4 ++-- src/sidebar/README.zh-CN.md | 4 ++-- src/tab/README.md | 3 +++ src/tab/README.zh-CN.md | 3 +++ src/tab/index.js | 2 ++ src/tabbar/README.zh-CN.md | 4 ++-- src/tabs/index.js | 2 ++ 11 files changed, 25 insertions(+), 15 deletions(-) diff --git a/src/button/README.zh-CN.md b/src/button/README.zh-CN.md index adde2f431..303d3abea 100644 --- a/src/button/README.zh-CN.md +++ b/src/button/README.zh-CN.md @@ -131,8 +131,8 @@ Vue.use(Button); | loading-text | 加载状态提示文字 | *string* | - | - | | loading-type | 加载图标类型,可选值为`spinner` | *string* | `circular` | - | | loading-size | 加载图标大小 | *string* | `20px` | - | -| url | 跳转链接 | *string* | - | - | -| to | 路由跳转对象,同 vue-router 的 [to 属性](https://router.vuejs.org/zh/api/#to) | *string \| object* | - | - | +| url | 点击后跳转的链接地址 | *string* | - | - | +| to | 点击后跳转的目标路由对象,同 vue-router 的 [to 属性](https://router.vuejs.org/zh/api/#to) | *string \| object* | - | - | | replace | 跳转时是否替换当前页面历史 | *boolean* | `false` | - | ### Events diff --git a/src/card/README.zh-CN.md b/src/card/README.zh-CN.md index 42f20160c..6cbf13df9 100644 --- a/src/card/README.zh-CN.md +++ b/src/card/README.zh-CN.md @@ -77,7 +77,7 @@ Vue.use(Card); | origin-price | 商品划线原价 | *string \| number* | - | - | | centered | 内容是否垂直居中 | *boolean* | `false` | - | | currency | 货币符号 | *string* | `¥` | - | -| thumb-link | 点击左侧图片后的跳转链接 | *string* | - | - | +| thumb-link | 点击左侧图片后跳转的链接地址 | *string* | - | - | | lazy-load | 是否开启图片懒加载,须配合 [Lazyload](#/zh-CN/lazyload) 组件使用 | *boolean* | `false` | - | ### Events diff --git a/src/cell/README.zh-CN.md b/src/cell/README.zh-CN.md index 75e5e1191..685f7f9e4 100644 --- a/src/cell/README.zh-CN.md +++ b/src/cell/README.zh-CN.md @@ -120,8 +120,8 @@ Vue.use(Cell).use(CellGroup); | value | 右侧内容 | *string \| number* | - | - | | label | 标题下方的描述信息 | *string* | - | - | | size | 单元格大小,可选值为 `large` | *string* | - | - | -| url | 跳转链接 | *string* | - | - | -| to | 路由跳转对象,同 vue-router 的 [to 属性](https://router.vuejs.org/zh/api/#to) | *string \| object* | - | - | +| url | 点击后跳转的链接地址 | *string* | - | - | +| to | 点击后跳转的目标路由对象,同 vue-router 的 [to 属性](https://router.vuejs.org/zh/api/#to) | *string \| object* | - | - | | border | 是否显示内边框 | *boolean* | `true` | - | | replace | 跳转时是否替换当前页面历史 | *boolean* | `false` | - | | clickable | 是否开启点击反馈 | *boolean* | `false` | - | diff --git a/src/goods-action/README.zh-CN.md b/src/goods-action/README.zh-CN.md index 3ed158098..1d6b04cfd 100644 --- a/src/goods-action/README.zh-CN.md +++ b/src/goods-action/README.zh-CN.md @@ -85,8 +85,8 @@ export default { | icon | 图标 | *string* | - | - | | icon-class | 图标额外类名 | *any* | - | - | | info | 图标右上角提示信息 | *string \| number* | - | - | -| url | 跳转链接 | *string* | - | - | -| to | 路由跳转对象,同 vue-router 的 [to 属性](https://router.vuejs.org/zh/api/#to) | *string \| object* | - | - | +| url | 点击后跳转的链接地址 | *string* | - | - | +| to | 点击后跳转的目标路由对象,同 vue-router 的 [to 属性](https://router.vuejs.org/zh/api/#to) | *string \| object* | - | - | | replace | 跳转时是否替换当前页面历史 | *boolean* | `false` | - | ### GoodsActionButton Props @@ -98,8 +98,8 @@ export default { | color | 按钮颜色,支持传入`linear-gradient`渐变色 | *string* | - | 2.1.8 | | disabled | 是否禁用按钮 | *boolean* | `false` | - | - | | loading | 是否显示为加载状态 | *boolean* | `false` | - | - | -| url | 跳转链接 | *string* | - | - | -| to | 路由跳转对象,同 vue-router 的 [to 属性](https://router.vuejs.org/zh/api/#to) | *string \| object* | - | - | +| url | 点击后跳转的链接地址 | *string* | - | - | +| to | 点击后跳转的目标路由对象,同 vue-router 的 [to 属性](https://router.vuejs.org/zh/api/#to) | *string \| object* | - | - | | replace | 跳转时是否替换当前页面历史 | *boolean* | `false` | - | ### GoodsActionIcon Slots diff --git a/src/grid/README.zh-CN.md b/src/grid/README.zh-CN.md index c3c59ebfd..d93a85a84 100644 --- a/src/grid/README.zh-CN.md +++ b/src/grid/README.zh-CN.md @@ -131,8 +131,8 @@ Vue.use(Grid).use(GridItem); |------|------|------|------|------| | text | 文字 | *string* | - | - | | icon | 图标名称或图片链接,可选值见 [Icon 组件](/#/zh-CN/icon) | *string* | - | - | -| url | 跳转链接 | *string* | - | - | -| to | 路由跳转对象,同 vue-router 的 [to 属性](https://router.vuejs.org/zh/api/#to) | *string \| object* | - | - | +| url | 点击后跳转的链接地址 | *string* | - | - | +| to | 点击后跳转的目标路由对象,同 vue-router 的 [to 属性](https://router.vuejs.org/zh/api/#to) | *string \| object* | - | - | | replace | 跳转时是否替换当前页面历史 | *boolean* | `false` | - | ### GridItem Events diff --git a/src/sidebar/README.zh-CN.md b/src/sidebar/README.zh-CN.md index d0020d46e..481b99173 100644 --- a/src/sidebar/README.zh-CN.md +++ b/src/sidebar/README.zh-CN.md @@ -67,8 +67,8 @@ export default { | title | 内容 | *string* | `''` | - | | info | 提示消息 | *string \| number* | `''` | - | | disabled | 是否禁用该项 | *boolean* | `false` | 2.2.0 | -| url | 跳转链接 | *string* | - | - | -| to | 路由跳转对象,同 vue-router 的 [to 属性](https://router.vuejs.org/zh/api/#to) | *string \| object* | - | 2.0.4 | +| url | 点击后跳转的链接地址 | *string* | - | - | +| to | 点击后跳转的目标路由对象,同 vue-router 的 [to 属性](https://router.vuejs.org/zh/api/#to) | *string \| object* | - | 2.0.4 | | replace | 跳转时是否替换当前页面历史 | *boolean* | `false` | 2.0.4 | ### SidebarItem Events diff --git a/src/tab/README.md b/src/tab/README.md index cb0c8df0c..aa695859e 100644 --- a/src/tab/README.md +++ b/src/tab/README.md @@ -201,6 +201,9 @@ In swipeable mode, you can switch tabs with swipe gestrue in the content | name | Identifier | *string \| number* | Index of tab | - | | title | Title | *string* | - | - | | disabled | Whether to disable tab | *boolean* | `false` | - | +| url | Link | *string* | - | 2.2.1 | +| to | Target route of the link, same as to of vue-router | *string \| object* | - | 2.2.1 | +| replace | If true, the navigation will not leave a history record | *boolean* | `false` | 2.2.1 | ### Tabs Slots diff --git a/src/tab/README.zh-CN.md b/src/tab/README.zh-CN.md index 08ce4d3e3..0ea71f460 100644 --- a/src/tab/README.zh-CN.md +++ b/src/tab/README.zh-CN.md @@ -205,6 +205,9 @@ export default { | name | 标签名称,作为匹配的标识符 | *string \| number* | 标签的索引值 | 2.0.6 | | title | 标题 | *string* | - | - | | disabled | 是否禁用标签 | *boolean* | `false` | - | +| url | 点击后跳转的链接地址 | *string* | - | 2.2.1 | +| to | 点击后跳转的目标路由对象,同 vue-router 的 [to 属性](https://router.vuejs.org/zh/api/#to) | *string \| object* | - | 2.2.1 | +| replace | 跳转时是否替换当前页面历史 | *boolean* | `false` | 2.2.1 | ### Tabs Slots diff --git a/src/tab/index.js b/src/tab/index.js index eea393bcf..2a7dedc6d 100644 --- a/src/tab/index.js +++ b/src/tab/index.js @@ -1,5 +1,6 @@ import { createNamespace } from '../utils'; import { ChildrenMixin } from '../mixins/relation'; +import { routeProps } from '../utils/router'; const [createComponent, bem] = createNamespace('tab'); @@ -7,6 +8,7 @@ export default createComponent({ mixins: [ChildrenMixin('vanTabs')], props: { + ...routeProps, name: [Number, String], title: String, disabled: Boolean diff --git a/src/tabbar/README.zh-CN.md b/src/tabbar/README.zh-CN.md index 7af90f64c..f5c6d8437 100644 --- a/src/tabbar/README.zh-CN.md +++ b/src/tabbar/README.zh-CN.md @@ -170,8 +170,8 @@ export default { | icon | 图标名称或图片链接,可选值见 [Icon 组件](/#/zh-CN/icon)| *string* | - | - | | dot | 是否显示小红点 | *boolean* | - | - | | info | 图标右上角提示信息 | *string \| number* | - | - | -| url | 跳转链接 | *string* | - | - | -| to | 路由跳转对象,同 vue-router 的 [to 属性](https://router.vuejs.org/zh/api/#to) | *string \| object* | - | - | +| url | 点击后跳转的链接地址 | *string* | - | - | +| to | 点击后跳转的目标路由对象,同 vue-router 的 [to 属性](https://router.vuejs.org/zh/api/#to) | *string \| object* | - | - | | replace | 跳转时是否替换当前页面历史 | *boolean* | `false` | - | ### TabbarItem Slots diff --git a/src/tabs/index.js b/src/tabs/index.js index 578194402..dc7748af8 100644 --- a/src/tabs/index.js +++ b/src/tabs/index.js @@ -1,5 +1,6 @@ import { createNamespace, isDef, addUnit } from '../utils'; import { scrollLeftTo } from './utils'; +import { route } from '../utils/router'; import { isHidden } from '../utils/dom/style'; import { ParentMixin } from '../mixins/relation'; import { BindEventMixin } from '../mixins/bind-event'; @@ -277,6 +278,7 @@ export default createComponent({ swipeThreshold={this.swipeThreshold} onClick={() => { this.onClick(index); + route(item.$router, item); }} /> ));