From 362e183804f9f94ec73b0f008e4102ae16b300d5 Mon Sep 17 00:00:00 2001
From: tangjinzhou <415800467@qq.com>
Date: Tue, 27 Feb 2018 14:08:15 +0800
Subject: [PATCH] fix input
---
components/input/Input.vue | 32 ++++-----
components/input/demo/basic.vue | 11 +---
components/input/demo/index.vue | 4 ++
components/input/demo/tooltip.vue | 76 ++++++++++++++++++++++
components/tooltip/abstractTooltipProps.js | 3 +-
5 files changed, 100 insertions(+), 26 deletions(-)
create mode 100644 components/input/demo/tooltip.vue
diff --git a/components/input/Input.vue b/components/input/Input.vue
index f8596244f..b3779cff9 100644
--- a/components/input/Input.vue
+++ b/components/input/Input.vue
@@ -151,35 +151,37 @@ export default {
const otherProps = omit(this.$props, [
'prefixCls',
])
- const { stateValue, getInputClassName, handleKeyDown, handleChange } = this
- const attrs = {
+ const { stateValue, getInputClassName, handleKeyDown, handleChange, $listeners } = this
+ const inputProps = {
+ domProps: {
+ value: stateValue,
+ },
attrs: { ...otherProps, ...this.$attrs },
+ on: {
+ ...$listeners,
+ keydown: handleKeyDown,
+ input: handleChange,
+ },
+ class: getInputClassName(),
+ ref: 'input',
}
return this.renderLabeledIcon(
,
)
},
},
render () {
if (this.$props.type === 'textarea') {
- const self = this
+ const { $listeners } = this
const textareaProps = {
props: this.$props,
attrs: this.$attrs,
on: {
- change (e) {
- self.handleChange(e)
- },
- keydown (e) {
- self.handleKeyDown(e)
- },
+ ...$listeners,
+ change: this.handleChange,
+ keydown: this.handleKeyDown,
},
}
return
diff --git a/components/input/demo/basic.vue b/components/input/demo/basic.vue
index a8ef283bd..4201fb155 100644
--- a/components/input/demo/basic.vue
+++ b/components/input/demo/basic.vue
@@ -1,12 +1,3 @@
-