Commit 8e4f708f254db4600751853ea984d1685817feb5
1 parent
02fa0d3f
update Tabs
@hezhiying
Showing
2 changed files
with
6 additions
and
6 deletions
Show diff stats
examples/routers/tabs.vue
| ... | ... | @@ -9,8 +9,8 @@ |
| 9 | 9 | </Col> |
| 10 | 10 | <Col :span="12"> |
| 11 | 11 | <Tabs type="card" closable @on-tab-remove="handleTagRemove"> |
| 12 | - <Tab-pane :label="tab.label" v-for="tab of tabs">{{tab.content}}</Tab-pane> | |
| 13 | - <Button size="small" slot="right" @click="addTab">添加</Button> | |
| 12 | + <Tab-pane :label="tab.label" v-for="tab of tabs" :key="tab">{{tab.content}}</Tab-pane> | |
| 13 | + <Button size="small" slot="extra" @click="addTab">添加</Button> | |
| 14 | 14 | </Tabs> |
| 15 | 15 | </Col> |
| 16 | 16 | </Row> | ... | ... |
src/components/tabs/tabs.vue
| ... | ... | @@ -12,7 +12,7 @@ |
| 12 | 12 | <Icon v-if="showClose(item)" type="ios-close-empty" @click.native.stop="handleRemove(index)"></Icon> |
| 13 | 13 | </div> |
| 14 | 14 | </div> |
| 15 | - <div :class="[prefixCls + '-nav-right']" v-if="showSlot"><slot name="right"></slot></div> | |
| 15 | + <div :class="[prefixCls + '-nav-right']" v-if="showSlot"><slot name="extra"></slot></div> | |
| 16 | 16 | </div> |
| 17 | 17 | </div> |
| 18 | 18 | </div> |
| ... | ... | @@ -61,7 +61,7 @@ |
| 61 | 61 | barWidth: 0, |
| 62 | 62 | barOffset: 0, |
| 63 | 63 | activeKey: this.value, |
| 64 | - showSlot:false | |
| 64 | + showSlot: false | |
| 65 | 65 | }; |
| 66 | 66 | }, |
| 67 | 67 | computed: { |
| ... | ... | @@ -228,8 +228,8 @@ |
| 228 | 228 | this.updateStatus(); |
| 229 | 229 | } |
| 230 | 230 | }, |
| 231 | - mounted(){ | |
| 232 | - this.showSlot = this.$slots.default !== undefined; | |
| 231 | + mounted () { | |
| 232 | + this.showSlot = this.$slots.extra !== undefined; | |
| 233 | 233 | } |
| 234 | 234 | }; |
| 235 | 235 | </script> | ... | ... |