|
1 |
| -import type { App, PropType, Plugin, ExtractPropTypes } from 'vue'; |
| 1 | +import type { App, PropType, ExtractPropTypes } from 'vue'; |
2 | 2 | import { watch, ref, onMounted, defineComponent, nextTick } from 'vue';
|
3 | 3 | import classNames from '../_util/classNames';
|
4 | 4 | import PropTypes from '../_util/vue-types';
|
5 |
| -import VcMentions from '../vc-mentions'; |
| 5 | +import VcMentions, { Option } from '../vc-mentions'; |
6 | 6 | import { mentionsProps as baseMentionsProps } from '../vc-mentions/src/mentionsProps';
|
7 | 7 | import useConfigInject from '../_util/hooks/useConfigInject';
|
8 | 8 | import { flattenChildren, getOptionProps } from '../_util/props-util';
|
9 | 9 | import { useInjectFormItemContext } from '../form/FormItemContext';
|
10 | 10 | import omit from '../_util/omit';
|
11 | 11 |
|
12 |
| -const { Option } = VcMentions; |
13 |
| - |
14 | 12 | interface MentionsConfig {
|
15 | 13 | prefix?: string | string[];
|
16 | 14 | split?: string;
|
@@ -85,8 +83,6 @@ const Mentions = defineComponent({
|
85 | 83 | name: 'AMentions',
|
86 | 84 | inheritAttrs: false,
|
87 | 85 | props: mentionsProps,
|
88 |
| - getMentions, |
89 |
| - Option, |
90 | 86 | emits: ['update:value', 'change', 'focus', 'blur', 'select', 'pressenter'],
|
91 | 87 | slots: ['notFoundContent', 'option'],
|
92 | 88 | setup(props, { slots, emit, attrs, expose }) {
|
@@ -209,20 +205,18 @@ const Mentions = defineComponent({
|
209 | 205 | },
|
210 | 206 | });
|
211 | 207 |
|
212 |
| -export const MentionsOption = { |
| 208 | +/* istanbul ignore next */ |
| 209 | +export const MentionsOption = defineComponent({ |
213 | 210 | ...Option,
|
214 | 211 | name: 'AMentionsOption',
|
215 |
| -}; |
216 |
| - |
217 |
| -/* istanbul ignore next */ |
218 |
| -Mentions.install = function (app: App) { |
219 |
| - app.component(Mentions.name, Mentions); |
220 |
| - app.component(MentionsOption.name, MentionsOption); |
221 |
| - return app; |
222 |
| -}; |
| 212 | +}); |
223 | 213 |
|
224 |
| -export default Mentions as typeof Mentions & |
225 |
| - Plugin & { |
226 |
| - getMentions: typeof getMentions; |
227 |
| - readonly Option: typeof Option; |
228 |
| - }; |
| 214 | +export default Object.assign(Mentions, { |
| 215 | + Option: MentionsOption, |
| 216 | + getMentions, |
| 217 | + install: (app: App) => { |
| 218 | + app.component(Mentions.name, Mentions); |
| 219 | + app.component(MentionsOption.name, MentionsOption); |
| 220 | + return app; |
| 221 | + }, |
| 222 | +}); |
0 commit comments