File tree 7 files changed +23
-16
lines changed
7 files changed +23
-16
lines changed Original file line number Diff line number Diff line change 1
1
module . exports = {
2
2
dev : {
3
- componentName : 'upload ' , // dev components
3
+ componentName : 'mentions ' , // dev components
4
4
} ,
5
5
} ;
Original file line number Diff line number Diff line change @@ -192,11 +192,6 @@ export default {
192
192
keydown : this . handleKeyDown ,
193
193
change : noop ,
194
194
} ,
195
- directives : [
196
- {
197
- name : 'ant-input' ,
198
- } ,
199
- ] ,
200
195
} ;
201
196
return < TextArea { ...textareaProps } ref = "input" /> ;
202
197
}
Original file line number Diff line number Diff line change @@ -97,6 +97,11 @@ const ResizableTextArea = {
97
97
style,
98
98
class : cls ,
99
99
on : omit ( getListeners ( this ) , 'pressEnter' ) ,
100
+ directives : [
101
+ {
102
+ name : 'ant-input' ,
103
+ } ,
104
+ ] ,
100
105
} ;
101
106
return (
102
107
< ResizeObserver onResize = { this . resizeOnNextFrame } disabled = { ! ( autoSize || autosize ) } >
Original file line number Diff line number Diff line change @@ -7,23 +7,23 @@ exports[`renders ./components/mentions/demo/basic.md correctly 1`] = `<div class
7
7
exports [` renders ./components/mentions/demo/form.md correctly 1` ] = `
8
8
<form class = " ant-form ant-form-horizontal" >
9
9
<div class = " ant-row ant-form-item" >
10
- <div class = " ant-col-5 ant-form-item-label" ><label for = " mentions_coders" title = " Top coders" class = " " >Top coders</label ></div >
11
- <div class = " ant-col-12 ant-form-item-control-wrapper" >
10
+ <div class = " ant-col ant-col -5 ant-form-item-label" ><label for = " mentions_coders" title = " Top coders" class = " " >Top coders</label ></div >
11
+ <div class = " ant-col ant-col -12 ant-form-item-control-wrapper" >
12
12
<div class = " ant-form-item-control" ><span class = " ant-form-item-children" ><div class = " ant-mentions" ><textarea rows = " 1" data-__meta = " [object Object]" data-__field = " [object Object]" id = " mentions_coders" ></textarea ></div ></span >
13
13
<!---->
14
14
</div >
15
15
</div >
16
16
</div >
17
17
<div class = " ant-row ant-form-item" >
18
- <div class = " ant-col-5 ant-form-item-label" ><label for = " mentions_bio" title = " Bio" class = " ant-form-item-required" >Bio</label ></div >
19
- <div class = " ant-col-12 ant-form-item-control-wrapper" >
18
+ <div class = " ant-col ant-col -5 ant-form-item-label" ><label for = " mentions_bio" title = " Bio" class = " ant-form-item-required" >Bio</label ></div >
19
+ <div class = " ant-col ant-col -12 ant-form-item-control-wrapper" >
20
20
<div class = " ant-form-item-control" ><span class = " ant-form-item-children" ><div class = " ant-mentions" ><textarea rows = " 3" placeholder = " You can use @ to ref user here" data-__meta = " [object Object]" data-__field = " [object Object]" id = " mentions_bio" ></textarea ></div ></span >
21
21
<!---->
22
22
</div >
23
23
</div >
24
24
</div >
25
25
<div class = " ant-row ant-form-item" >
26
- <div class = " ant-col-12 ant-col-offset-5 ant-form-item-control-wrapper" >
26
+ <div class = " ant-col ant-col -12 ant-col-offset-5 ant-form-item-control-wrapper" >
27
27
<div class = " ant-form-item-control" ><span class = " ant-form-item-children" ><button type = " button" class = " ant-btn ant-btn-primary" ><span >Submit</span ></button ><button type = " button" class = " ant-btn" style = " margin-left: 8px;" ><span >Reset</span ></button ></span >
28
28
<!---->
29
29
</div >
Original file line number Diff line number Diff line change @@ -11,7 +11,7 @@ Basic usage.
11
11
``` tpl
12
12
<template>
13
13
<a-mentions
14
- defaultValue="@afc163 "
14
+ v-model="value "
15
15
@change="onChange"
16
16
@select="onSelect"
17
17
>
@@ -22,6 +22,11 @@ Basic usage.
22
22
</template>
23
23
<script>
24
24
export default {
25
+ data() {
26
+ return {
27
+ value: '@afc163',
28
+ }
29
+ },
25
30
methods: {
26
31
onSelect(option) {
27
32
console.log('select', option);
Original file line number Diff line number Diff line change @@ -2,6 +2,7 @@ import Menu, { MenuItem } from '../../vc-menu';
2
2
import PropTypes from '../../_util/vue-types' ;
3
3
import { OptionProps } from './Option' ;
4
4
5
+ function noop ( ) { }
5
6
export default {
6
7
name : 'DropdownMenu' ,
7
8
props : {
@@ -18,8 +19,8 @@ export default {
18
19
activeIndex,
19
20
setActiveIndex,
20
21
selectOption,
21
- onFocus,
22
- onBlur,
22
+ onFocus = noop ,
23
+ onBlur = noop ,
23
24
} = this . mentionsContext ;
24
25
const { prefixCls, options } = this . $props ;
25
26
const activeOption = options [ activeIndex ] || { } ;
Original file line number Diff line number Diff line change @@ -2,7 +2,6 @@ import omit from 'omit.js';
2
2
import KeyCode from '../../_util/KeyCode' ;
3
3
import BaseMixin from '../../_util/BaseMixin' ;
4
4
import {
5
- getStyle ,
6
5
getSlots ,
7
6
hasProp ,
8
7
getOptionProps ,
@@ -73,7 +72,8 @@ const Mentions = {
73
72
}
74
73
this . $emit ( 'change' , value ) ;
75
74
} ,
76
- onChange ( { target : { value } } ) {
75
+ onChange ( { target : { value, composing } } ) {
76
+ if ( composing ) return ;
77
77
this . triggerChange ( value ) ;
78
78
} ,
79
79
onKeyDown ( event ) {
@@ -283,6 +283,7 @@ const Mentions = {
283
283
< textarea
284
284
ref = "textarea"
285
285
{ ...{
286
+ directives : [ { name : 'ant-input' } ] ,
286
287
attrs : { ...inputProps , ...this . $attrs } ,
287
288
domProps : {
288
289
value,
You can’t perform that action at this time.
0 commit comments