pull/9/head
tangjinzhou 2017-11-22 15:45:43 +08:00
parent d1d56eedcd
commit 837d4cadeb
2 changed files with 7 additions and 7 deletions

View File

@ -1,10 +1,9 @@
<script> <script>
import RefMixin from './RefMixin'
import TabBarMixin from './TabBarMixin' import TabBarMixin from './TabBarMixin'
function noop () { function noop () {
} }
export default { export default {
mixins: [RefMixin, TabBarMixin], mixins: [TabBarMixin],
name: 'TabBar', name: 'TabBar',
props: { props: {
prefixCls: { prefixCls: {

View File

@ -17,10 +17,10 @@ export default {
const onClick = () => { const onClick = () => {
!child.disabled && this.onTabClick(key) !child.disabled && this.onTabClick(key)
} }
const ref = {} // const ref = {}
if (activeKey === key) { // if (activeKey === key) {
ref.ref = this.saveRef('activeTab') // ref.ref = this.saveRef('activeTab')
} // }
rst.push( rst.push(
<div <div
role='tab' role='tab'
@ -29,6 +29,7 @@ export default {
class={cls} class={cls}
key={key} key={key}
onClick={onClick} onClick={onClick}
ref={activeKey === key ? 'activeTab' : undefined}
> >
{child.tab} {child.tab}
</div> </div>
@ -61,7 +62,7 @@ export default {
role='tablist' role='tablist'
class={cls} class={cls}
tabIndex='0' tabIndex='0'
ref={this.saveRef('root')} ref='root'
onKeydown={onKeyDown} onKeydown={onKeyDown}
> >
{children} {children}