From 728a0e26c5089bb636273d29c1534d1618ed8b6a Mon Sep 17 00:00:00 2001 From: neverland Date: Tue, 25 Dec 2018 21:41:57 +0800 Subject: [PATCH] [new feature] Tabbar: add active-color prop (#2372) --- packages/tabbar-item/index.vue | 7 ++++ packages/tabbar/demo/index.vue | 21 +++++++++-- packages/tabbar/en-US.md | 2 ++ packages/tabbar/index.vue | 1 + .../test/__snapshots__/demo.spec.js.snap | 36 +++++++++++++++++++ packages/tabbar/zh-CN.md | 16 ++++++++- 6 files changed, 79 insertions(+), 4 deletions(-) diff --git a/packages/tabbar-item/index.vue b/packages/tabbar-item/index.vue index f0ef5c954..e93ac536d 100644 --- a/packages/tabbar-item/index.vue +++ b/packages/tabbar-item/index.vue @@ -1,6 +1,7 @@ @@ -45,10 +57,12 @@ export default { i18n: { 'zh-CN': { - title2: '自定义图标' + customIcon: '自定义图标', + customColor: '自定义颜色' }, 'en-US': { - title2: 'Custom icon' + customIcon: 'Custom icon', + customColor: 'Custom Color' } }, @@ -56,6 +70,7 @@ export default { return { active: 0, active2: 0, + active3: 0, icon: { normal: 'https://img.yzcdn.cn/public_files/2017/10/13/c547715be149dd3faa817e4a948b40c4.png', active: 'https://img.yzcdn.cn/public_files/2017/10/13/793c77793db8641c4c325b7f25bf130d.png' diff --git a/packages/tabbar/en-US.md b/packages/tabbar/en-US.md index 0e0b34b63..7fe7b1c25 100644 --- a/packages/tabbar/en-US.md +++ b/packages/tabbar/en-US.md @@ -31,6 +31,7 @@ export default { ``` #### Custom icon + Use `icon` slot to custom icon ```html @@ -69,6 +70,7 @@ export default { | v-model | Index of current tab | `Number` | - | | fixed | Whether to fixed bottom | `Boolean` | `true` | | z-index | Z-index | `Number` | `1` | +| active-color | Color of active tab item | `String` | `#1989fa` | ### Tabbar Event diff --git a/packages/tabbar/index.vue b/packages/tabbar/index.vue index e30664cbd..4ed9c28e9 100644 --- a/packages/tabbar/index.vue +++ b/packages/tabbar/index.vue @@ -22,6 +22,7 @@ export default create({ props: { value: Number, + activeColor: String, fixed: { type: Boolean, default: true diff --git a/packages/tabbar/test/__snapshots__/demo.spec.js.snap b/packages/tabbar/test/__snapshots__/demo.spec.js.snap index e8e8ecf3b..1b17b4b1f 100644 --- a/packages/tabbar/test/__snapshots__/demo.spec.js.snap +++ b/packages/tabbar/test/__snapshots__/demo.spec.js.snap @@ -76,5 +76,41 @@ exports[`renders demo correctly 1`] = ` +
+
+
+
+ + + +
+
标签
+
+
+
+ + + +
+
标签
+
+
+
+ + + +
+
标签
+
+
+
+ + + +
+
标签
+
+
+
`; diff --git a/packages/tabbar/zh-CN.md b/packages/tabbar/zh-CN.md index 6a98c7824..cc19ed004 100644 --- a/packages/tabbar/zh-CN.md +++ b/packages/tabbar/zh-CN.md @@ -11,7 +11,6 @@ Vue.use(Tabbar).use(TabbarItem); #### 基础用法 - ```html 标签 @@ -33,6 +32,7 @@ export default { #### 自定义图标 + 通过 icon 插槽自定义图标,可以通过 `slot-scope` 判断标签是否选中 ```html @@ -64,6 +64,19 @@ export default { } ``` +#### 自定义颜色 + +```html + + 标签 + 标签 + 标签 + 标签 + +``` ### Tabbar API @@ -72,6 +85,7 @@ export default { | v-model | 当前选中标签的索引 | `Number` | - | - | | fixed | 是否固定在底部 | `Boolean` | `true` | - | | z-index | 元素 z-index | `Number` | `1` | 1.1.9 | +| active-color | 选中标签的颜色 | `String` | `#1989fa` | 1.5.1 | ### Tabbar Event