Commit 0c5e01f1a8fdfc6ce4d15119d809c77cd53b9454
1 parent
12bd19d7
fixed #185
fixed #185
Showing
2 changed files
with
9 additions
and
10 deletions
Show diff stats
src/components/tabs/tabs.vue
@@ -172,7 +172,6 @@ | @@ -172,7 +172,6 @@ | ||
172 | const nav = this.navList[index]; | 172 | const nav = this.navList[index]; |
173 | if (nav.disabled) return; | 173 | if (nav.disabled) return; |
174 | this.activeKey = nav.key; | 174 | this.activeKey = nav.key; |
175 | - this.updateStatus(); | ||
176 | this.$emit('on-click', nav.key); | 175 | this.$emit('on-click', nav.key); |
177 | }, | 176 | }, |
178 | handleRemove (index) { | 177 | handleRemove (index) { |
@@ -205,6 +204,7 @@ | @@ -205,6 +204,7 @@ | ||
205 | watch: { | 204 | watch: { |
206 | activeKey () { | 205 | activeKey () { |
207 | this.updateBar(); | 206 | this.updateBar(); |
207 | + this.updateStatus(); | ||
208 | } | 208 | } |
209 | } | 209 | } |
210 | }; | 210 | }; |
test/routers/tabs.vue
1 | <template> | 1 | <template> |
2 | - <i-button @click="add">add</i-button>{{more}} | ||
3 | - <Tabs active-key="key1" type="card" closable> | ||
4 | - <tab-pane label="标签一" key="key1">标签一的内容</tab-pane> | ||
5 | - <tab-pane label="标签二" key="key2">标签二的内容</tab-pane> | ||
6 | - <tab-pane label="标签三" key="key3">标签三的内容</tab-pane> | ||
7 | - <tab-pane label="标签四" key="key4" v-if="more">标签四的内容</tab-pane> | 2 | + <Tabs :active-key.sync="activeKey" :animated="true"> |
3 | + <Tab-pane label="标签一" key="key1">标签一的内容</Tab-pane> | ||
4 | + <Tab-pane label="标签二" key="key2">标签二的内容</Tab-pane> | ||
5 | + <Tab-pane label="标签三" key="key3">标签三的内容</Tab-pane> | ||
8 | </Tabs> | 6 | </Tabs> |
7 | + <i-button @click="change">change</i-button> | ||
9 | </template> | 8 | </template> |
10 | <script> | 9 | <script> |
11 | export default { | 10 | export default { |
12 | data () { | 11 | data () { |
13 | return { | 12 | return { |
14 | - more: false | 13 | + activeKey: 'key2' |
15 | } | 14 | } |
16 | }, | 15 | }, |
17 | methods: { | 16 | methods: { |
18 | - add () { | ||
19 | - this.more = !this.more; | 17 | + change () { |
18 | + this.activeKey = 'key1'; | ||
20 | } | 19 | } |
21 | } | 20 | } |
22 | } | 21 | } |