Skip to content

Commit 2e22c64

Browse files
committed
perf: mentions rm defaultProps
1 parent 2a871a3 commit 2e22c64

File tree

2 files changed

+7
-19
lines changed

2 files changed

+7
-19
lines changed

components/mentions/index.jsx

+6-10
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import classNames from 'classnames';
22
import omit from 'omit.js';
33
import PropTypes from '../_util/vue-types';
44
import VcMentions from '../vc-mentions';
5-
import { mentionsProps, defaultProps } from '../vc-mentions/src/mentionsProps';
5+
import { mentionsProps } from '../vc-mentions/src/mentionsProps';
66
import Base from '../base';
77
import Spin from '../spin';
88
import BaseMixin from '../_util/BaseMixin';
@@ -12,7 +12,6 @@ import {
1212
getComponentFromProp,
1313
getListeners,
1414
filterEmpty,
15-
initDefaultProps,
1615
} from '../_util/props-util';
1716

1817
const { Option } = VcMentions;
@@ -60,13 +59,10 @@ const Mentions = {
6059
},
6160
Option: { ...Option, name: 'AMentionsOption' },
6261
getMentions,
63-
props: initDefaultProps(
64-
{
65-
...mentionsProps,
66-
loading: PropTypes.bool,
67-
},
68-
defaultProps,
69-
),
62+
props: {
63+
...mentionsProps,
64+
loading: PropTypes.bool,
65+
},
7066
inject: {
7167
configProvider: { default: () => ConfigConsumerProps },
7268
},
@@ -168,7 +164,7 @@ const Mentions = {
168164
children: this.getOptions(),
169165
},
170166
class: mergedClassName,
171-
attrs: this.$attrs,
167+
attrs: { rows: 1, ...this.$attrs },
172168
on: {
173169
...getListeners(this),
174170
change: this.onChange,

components/vc-mentions/src/mentionsProps.js

+1-9
Original file line numberDiff line numberDiff line change
@@ -35,14 +35,6 @@ export const defaultProps = {
3535
split: ' ',
3636
validateSearch: defaultValidateSearch,
3737
filterOption: defaultFilterOption,
38-
notFoundContent: 'Not Found',
39-
rows: 1,
4038
};
4139

42-
export default initDefaultProps(vcMentionsProps, {
43-
prefix: '@',
44-
split: ' ',
45-
validateSearch: defaultValidateSearch,
46-
filterOption: defaultFilterOption,
47-
notFoundContent: 'Not Found',
48-
});
40+
export default initDefaultProps(vcMentionsProps, defaultProps);

0 commit comments

Comments
 (0)