Skip to content

Commit 5685c08

Browse files
committed
feat(textarea): add change event
1 parent 9ffb465 commit 5685c08

File tree

3 files changed

+8
-5
lines changed

3 files changed

+8
-5
lines changed

src/common/mixins/input.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,10 @@
1+
const EVENT_CHANGE = 'change'
2+
13
export default {
24
methods: {
5+
changeHander(e) {
6+
this.$emit(EVENT_CHANGE, e)
7+
},
38
focus() {
49
this.$refs.input.focus()
510
},

src/components/input/input.vue

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,6 @@
3333
import inputMixin from '../../common/mixins/input'
3434
const COMPONENT_NAME = 'cube-input'
3535
const EVENT_INPUT = 'input'
36-
const EVENT_CHANGE = 'change'
3736
const EVENT_BLUR = 'blur'
3837
const EVENT_FOCUS = 'focus'
3938
@@ -145,9 +144,6 @@
145144
}
146145
},
147146
methods: {
148-
changeHander(e) {
149-
this.$emit(EVENT_CHANGE, e)
150-
},
151147
formatClearable() {
152148
if (typeof this.clearable === 'boolean') {
153149
this.formatedClearable.visible = this.clearable

src/components/textarea/textarea.vue

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,9 @@
99
:maxlength="maxlength"
1010
:disabled="disabled"
1111
@focus="handleFocus"
12-
@blur="handleBlur">
12+
@blur="handleBlur"
13+
@change="changeHander"
14+
>
1315
</textarea>
1416
<span v-if="indicator" v-show="expanded" class="cube-textarea-indicator">{{indicatorConf.remain ? remain : count}}</span>
1517
</div>

0 commit comments

Comments
 (0)