perf: inject default

pull/471/head
tangjinzhou 2019-01-28 21:09:13 +08:00
parent c9d3f7b79c
commit de68d08798
29 changed files with 35 additions and 35 deletions

View File

@ -24,7 +24,7 @@ export default function connect(mapStateToProps) {
name: `Connect_${getDisplayName(WrappedComponent)}`, name: `Connect_${getDisplayName(WrappedComponent)}`,
props, props,
inject: { inject: {
storeContext: { default: {} }, storeContext: { default: () => ({}) },
}, },
data() { data() {
this.store = this.storeContext.store; this.store = this.storeContext.store;

View File

@ -15,8 +15,8 @@ export default {
href: '#', href: '#',
}), }),
inject: { inject: {
antAnchor: { default: {} }, antAnchor: { default: () => ({}) },
antAnchorContext: { default: {} }, antAnchorContext: { default: () => ({}) },
}, },
mounted() { mounted() {

View File

@ -142,8 +142,8 @@ const Cascader = {
event: 'change', event: 'change',
}, },
inject: { inject: {
configProvider: { default: {} }, configProvider: { default: () => ({}) },
localeData: { default: {} }, localeData: { default: () => ({}) },
}, },
data() { data() {
this.cachedOptions = []; this.cachedOptions = [];

View File

@ -27,7 +27,7 @@ export default {
prop: 'checked', prop: 'checked',
}, },
inject: { inject: {
checkboxGroupContext: { default: null }, checkboxGroupContext: { default: () => null },
}, },
methods: { methods: {
handleChange(event) { handleChange(event) {

View File

@ -35,7 +35,7 @@ const Drawer = {
}, },
inject: { inject: {
parentDrawer: { parentDrawer: {
default: null, default: () => null,
}, },
}, },
provide() { provide() {

View File

@ -34,7 +34,7 @@ export default {
event: 'visibleChange', event: 'visibleChange',
}, },
inject: { inject: {
configProvider: { default: {} }, configProvider: { default: () => ({}) },
}, },
render() { render() {
const { const {

View File

@ -21,7 +21,7 @@ const Dropdown = {
event: 'visibleChange', event: 'visibleChange',
}, },
inject: { inject: {
configProvider: { default: {} }, configProvider: { default: () => ({}) },
}, },
methods: { methods: {
getTransitionName() { getTransitionName() {

View File

@ -19,7 +19,7 @@ import BaseMixin from '../_util/BaseMixin';
import { cloneElement, cloneVNodes } from '../_util/vnode'; import { cloneElement, cloneVNodes } from '../_util/vnode';
import Icon from '../icon'; import Icon from '../icon';
function noop(){} function noop() {}
export const FormItemProps = { export const FormItemProps = {
id: PropTypes.string, id: PropTypes.string,
prefixCls: PropTypes.string, prefixCls: PropTypes.string,
@ -46,8 +46,8 @@ export default {
colon: true, colon: true,
}), }),
inject: { inject: {
FormProps: { default: {} }, FormProps: { default: () => ({}) },
decoratorFormProps: { default: {} }, decoratorFormProps: { default: () => ({}) },
collectFormItemContext: { default: () => noop }, collectFormItemContext: { default: () => noop },
}, },
data() { data() {

View File

@ -32,7 +32,7 @@ export default {
name: 'ACol', name: 'ACol',
inject: { inject: {
rowContext: { rowContext: {
default: null, default: () => null,
}, },
}, },
render() { render() {

View File

@ -108,7 +108,7 @@ export default {
}; };
}, },
inject: { inject: {
siderHook: { default: {} }, siderHook: { default: () => ({}) },
}, },
// getChildContext() { // getChildContext() {
// return { // return {

View File

@ -53,7 +53,7 @@ export default {
Meta, Meta,
props: ListItemProps, props: ListItemProps,
inject: { inject: {
listContext: { default: {} }, listContext: { default: () => ({}) },
}, },
render() { render() {

View File

@ -8,7 +8,7 @@ export default {
children: PropTypes.func, children: PropTypes.func,
}, },
inject: { inject: {
localeData: { default: {} }, localeData: { default: () => ({}) },
}, },
methods: { methods: {
getLocale() { getLocale() {

View File

@ -49,8 +49,8 @@ const Menu = {
}, },
mixins: [BaseMixin], mixins: [BaseMixin],
inject: { inject: {
layoutSiderContext: { default: {} }, layoutSiderContext: { default: () => ({}) },
configProvider: { default: {} }, configProvider: { default: () => ({}) },
}, },
model: { model: {
prop: 'selectedKeys', prop: 'selectedKeys',

View File

@ -107,7 +107,7 @@ const Select = {
event: 'change', event: 'change',
}, },
inject: { inject: {
configProvider: { default: {} }, configProvider: { default: () => ({}) },
}, },
created() { created() {
warning( warning(

View File

@ -87,7 +87,7 @@ const TimePicker = {
event: 'change', event: 'change',
}, },
inject: { inject: {
configProvider: { default: {} }, configProvider: { default: () => ({}) },
}, },
data() { data() {
const value = this.value || this.defaultValue; const value = this.value || this.defaultValue;

View File

@ -34,7 +34,7 @@ export default {
event: 'visibleChange', event: 'visibleChange',
}, },
inject: { inject: {
configProvider: { default: {} }, configProvider: { default: () => ({}) },
}, },
data() { data() {
return { return {

View File

@ -34,7 +34,7 @@ const TreeSelect = {
event: 'change', event: 'change',
}, },
inject: { inject: {
configProvider: { default: {} }, configProvider: { default: () => ({}) },
}, },
created() { created() {
warning( warning(

View File

@ -21,7 +21,7 @@ const BaseTable = {
isAnyColumnsFixed: PropTypes.bool, isAnyColumnsFixed: PropTypes.bool,
}, },
inject: { inject: {
table: { default: {} }, table: { default: () => ({}) },
}, },
methods: { methods: {
getColumns(cols) { getColumns(cols) {

View File

@ -15,7 +15,7 @@ export default {
isAnyColumnsFixed: PropTypes.bool, isAnyColumnsFixed: PropTypes.bool,
}, },
inject: { inject: {
table: { default: {} }, table: { default: () => ({}) },
}, },
mounted() { mounted() {
this.updateTableRef(); this.updateTableRef();

View File

@ -7,7 +7,7 @@ export default {
columns: PropTypes.array, columns: PropTypes.array,
}, },
inject: { inject: {
table: { default: {} }, table: { default: () => ({}) },
}, },
render() { render() {
const { fixed, table } = this; const { fixed, table } = this;

View File

@ -12,7 +12,7 @@ export default {
expander: PropTypes.object.isRequired, expander: PropTypes.object.isRequired,
}, },
inject: { inject: {
table: { default: {} }, table: { default: () => ({}) },
}, },
mounted() { mounted() {
this.updateTableRef(); this.updateTableRef();

View File

@ -41,7 +41,7 @@ export default {
expander: PropTypes.object.isRequired, expander: PropTypes.object.isRequired,
}, },
inject: { inject: {
table: { default: {} }, table: { default: () => ({}) },
}, },
render() { render() {

View File

@ -15,7 +15,7 @@ export default {
disabled: PropTypes.bool, disabled: PropTypes.bool,
}, },
inject: { inject: {
sentinelContext: { default: {} }, sentinelContext: { default: () => ({}) },
}, },
render() { render() {
const { destroyInactiveTabPane, active, forceRender, rootPrefixCls } = this.$props; const { destroyInactiveTabPane, active, forceRender, rootPrefixCls } = this.$props;

View File

@ -101,7 +101,7 @@ const BasePopup = {
__propsSymbol__: PropTypes.any, __propsSymbol__: PropTypes.any,
}, },
inject: { inject: {
vcTreeSelect: { default: {} }, vcTreeSelect: { default: () => ({}) },
}, },
watch: { watch: {
__propsSymbol__() { __propsSymbol__() {

View File

@ -52,7 +52,7 @@ export default function(modeName) {
}, },
), ),
inject: { inject: {
vcTreeSelect: { default: {} }, vcTreeSelect: { default: () => ({}) },
}, },
created() { created() {
this.domRef = createRef(); this.domRef = createRef();

View File

@ -20,7 +20,7 @@ const SearchInput = {
ariaId: PropTypes.string, ariaId: PropTypes.string,
}, },
inject: { inject: {
vcTreeSelect: { default: {} }, vcTreeSelect: { default: () => ({}) },
}, },
created() { created() {

View File

@ -29,7 +29,7 @@ const MultipleSelector = {
// onChoiceAnimationLeave: PropTypes.func, // onChoiceAnimationLeave: PropTypes.func,
}, },
inject: { inject: {
vcTreeSelect: { default: {} }, vcTreeSelect: { default: () => ({}) },
}, },
created() { created() {
this.inputRef = createRef(); this.inputRef = createRef();

View File

@ -58,8 +58,8 @@ const TreeNode = {
}; };
}, },
inject: { inject: {
vcTree: { default: {} }, vcTree: { default: () => ({}) },
vcTreeNode: { default: {} }, vcTreeNode: { default: () => ({}) },
}, },
provide() { provide() {
return { return {

View File

@ -77,7 +77,7 @@ export default {
}; };
}, },
inject: { inject: {
vcTriggerContext: { default: {} }, vcTriggerContext: { default: () => ({}) },
}, },
data() { data() {
const props = this.$props; const props = this.$props;