diff --git a/components/_util/warning.js b/components/_util/warning.js index 9603df24b..f7a301eb3 100644 --- a/components/_util/warning.js +++ b/components/_util/warning.js @@ -2,8 +2,10 @@ import warning from 'warning' const warned = {} export default (valid, message) => { - if (!valid && !warned[message]) { - warning(false, message) - warned[message] = true + if (process.env.NODE_ENV !== 'production') { + if (!valid && !warned[message]) { + warning(false, message) + warned[message] = true + } } } diff --git a/components/tabs/TabBarMixin.js b/components/tabs/TabBarMixin.js index 3ee646752..487373645 100644 --- a/components/tabs/TabBarMixin.js +++ b/components/tabs/TabBarMixin.js @@ -1,4 +1,6 @@ import Icon from '../icon' +function noop () { +} export default { props: { prefixCls: { @@ -11,11 +13,11 @@ export default { }, disabled: Boolean, onKeyDown: { - default: () => {}, + default: noop, type: Function, }, onTabClick: { - default: () => {}, + default: noop, type: Function, }, activeKey: String, @@ -23,11 +25,11 @@ export default { extraContent: [String, Number, Function], hideAdd: Boolean, removeTab: { - default: () => {}, + default: noop, type: Function, }, createNewTab: { - default: () => {}, + default: noop, type: Function, }, }, diff --git a/components/tabs/Tabs.vue b/components/tabs/Tabs.vue index 9ecbe5a6d..f943d7040 100644 --- a/components/tabs/Tabs.vue +++ b/components/tabs/Tabs.vue @@ -22,6 +22,8 @@ function activeKeyIsValid (t, key) { }) return key !== undefined && keys.indexOf(key) >= 0 } +function noop () { +} export default { name: 'Tabs', components: { Icon }, @@ -50,8 +52,8 @@ export default { return ['line', 'card', 'editable-card'].includes(value) }, }, - onChange: { type: Function, default: () => {} }, - onTabClick: { type: Function, default: () => {} }, + onChange: { type: Function, default: noop }, + onTabClick: { type: Function, default: noop }, }, data () { return {