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)}`,
props,
inject: {
storeContext: { default: {} },
storeContext: { default: () => ({}) },
},
data() {
this.store = this.storeContext.store;

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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