pull/9/head
tangjinzhou 2017-12-08 09:49:47 +08:00
parent 4f9ccead27
commit 4fc9d027f5
3 changed files with 15 additions and 9 deletions

View File

@ -2,8 +2,10 @@ import warning from 'warning'
const warned = {} const warned = {}
export default (valid, message) => { export default (valid, message) => {
if (!valid && !warned[message]) { if (process.env.NODE_ENV !== 'production') {
warning(false, message) if (!valid && !warned[message]) {
warned[message] = true warning(false, message)
warned[message] = true
}
} }
} }

View File

@ -1,4 +1,6 @@
import Icon from '../icon' import Icon from '../icon'
function noop () {
}
export default { export default {
props: { props: {
prefixCls: { prefixCls: {
@ -11,11 +13,11 @@ export default {
}, },
disabled: Boolean, disabled: Boolean,
onKeyDown: { onKeyDown: {
default: () => {}, default: noop,
type: Function, type: Function,
}, },
onTabClick: { onTabClick: {
default: () => {}, default: noop,
type: Function, type: Function,
}, },
activeKey: String, activeKey: String,
@ -23,11 +25,11 @@ export default {
extraContent: [String, Number, Function], extraContent: [String, Number, Function],
hideAdd: Boolean, hideAdd: Boolean,
removeTab: { removeTab: {
default: () => {}, default: noop,
type: Function, type: Function,
}, },
createNewTab: { createNewTab: {
default: () => {}, default: noop,
type: Function, type: Function,
}, },
}, },

View File

@ -22,6 +22,8 @@ function activeKeyIsValid (t, key) {
}) })
return key !== undefined && keys.indexOf(key) >= 0 return key !== undefined && keys.indexOf(key) >= 0
} }
function noop () {
}
export default { export default {
name: 'Tabs', name: 'Tabs',
components: { Icon }, components: { Icon },
@ -50,8 +52,8 @@ export default {
return ['line', 'card', 'editable-card'].includes(value) return ['line', 'card', 'editable-card'].includes(value)
}, },
}, },
onChange: { type: Function, default: () => {} }, onChange: { type: Function, default: noop },
onTabClick: { type: Function, default: () => {} }, onTabClick: { type: Function, default: noop },
}, },
data () { data () {
return { return {