Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
E
Element
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
CI / CD Analytics
Repository Analytics
Value Stream Analytics
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
林焕东
Element
Commits
3820ec03
Commit
3820ec03
authored
Jan 06, 2017
by
baiyaaaaa
Committed by
GitHub
Jan 06, 2017
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #2263 from Kingwl/input-resize
Input: support resize prop
parents
0b8b011d
84d86b4c
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
12 additions
and
3 deletions
+12
-3
examples/docs/en-US/input.md
examples/docs/en-US/input.md
+1
-0
examples/docs/zh-CN/input.md
examples/docs/zh-CN/input.md
+1
-0
packages/input/src/calcTextareaHeight.js
packages/input/src/calcTextareaHeight.js
+5
-2
packages/input/src/input.vue
packages/input/src/input.vue
+5
-1
No files found.
examples/docs/en-US/input.md
View file @
3820ec03
...
@@ -565,6 +565,7 @@ Search data from server-side.
...
@@ -565,6 +565,7 @@ Search data from server-side.
|name | same as
`name`
in native input | string | — | — |
|name | same as
`name`
in native input | string | — | — |
|max | same as
`max`
in native input |
*
| — | — |
|max | same as
`max`
in native input |
*
| — | — |
|min | same as
`min`
in native input |
*
| — | — |
|min | same as
`min`
in native input |
*
| — | — |
|resize| control the resizability | string | none, both, horizontal, vertical | — |
|autofocus | same as
`autofocus`
in native input | boolean | — | false |
|autofocus | same as
`autofocus`
in native input | boolean | — | false |
|form | same as
`form`
in native input | string | — | — |
|form | same as
`form`
in native input | string | — | — |
...
...
examples/docs/zh-CN/input.md
View file @
3820ec03
...
@@ -728,6 +728,7 @@ export default {
...
@@ -728,6 +728,7 @@ export default {
| name | 原生属性 | string | — | — |
| name | 原生属性 | string | — | — |
| max | 原生属性,设置最大值 |
*
| — | — |
| max | 原生属性,设置最大值 |
*
| — | — |
| min | 原生属性,设置最小值 |
*
| — | — |
| min | 原生属性,设置最小值 |
*
| — | — |
| resize | 控制是否能被用户缩放 | string | none, both, horizontal, vertical | — |
| autofocus | 原生属性,自动获取焦点 | boolean | true, false | false |
| autofocus | 原生属性,自动获取焦点 | boolean | true, false | false |
| form | 原生属性 | string | — | — |
| form | 原生属性 | string | — | — |
...
...
packages/input/src/calcTextareaHeight.js
View file @
3820ec03
import
merge
from
'
element-ui/src/utils/merge
'
;
let
hiddenTextarea
;
let
hiddenTextarea
;
const
HIDDEN_STYLE
=
`
const
HIDDEN_STYLE
=
`
...
@@ -53,7 +55,8 @@ function calculateNodeStyling(node) {
...
@@ -53,7 +55,8 @@ function calculateNodeStyling(node) {
export
default
function
calcTextareaHeight
(
export
default
function
calcTextareaHeight
(
targetNode
,
targetNode
,
minRows
=
null
,
minRows
=
null
,
maxRows
=
null
maxRows
=
null
,
options
=
null
)
{
)
{
if
(
!
hiddenTextarea
)
{
if
(
!
hiddenTextarea
)
{
hiddenTextarea
=
document
.
createElement
(
'
textarea
'
);
hiddenTextarea
=
document
.
createElement
(
'
textarea
'
);
...
@@ -96,5 +99,5 @@ export default function calcTextareaHeight(
...
@@ -96,5 +99,5 @@ export default function calcTextareaHeight(
height
=
Math
.
min
(
maxHeight
,
height
);
height
=
Math
.
min
(
maxHeight
,
height
);
}
}
return
{
height
:
height
+
'
px
'
}
;
return
merge
({
height
:
height
+
'
px
'
},
options
)
;
};
};
packages/input/src/input.vue
View file @
3820ec03
...
@@ -88,6 +88,7 @@
...
@@ -88,6 +88,7 @@
value
:
[
String
,
Number
],
value
:
[
String
,
Number
],
placeholder
:
String
,
placeholder
:
String
,
size
:
String
,
size
:
String
,
resize
:
String
,
readonly
:
Boolean
,
readonly
:
Boolean
,
autofocus
:
Boolean
,
autofocus
:
Boolean
,
icon
:
String
,
icon
:
String
,
...
@@ -149,7 +150,10 @@
...
@@ -149,7 +150,10 @@
const
minRows
=
autosize
.
minRows
;
const
minRows
=
autosize
.
minRows
;
const
maxRows
=
autosize
.
maxRows
;
const
maxRows
=
autosize
.
maxRows
;
this
.
textareaStyle
=
calcTextareaHeight
(
this
.
$refs
.
textarea
,
minRows
,
maxRows
);
const
options
=
{
resize
:
this
.
resize
};
this
.
textareaStyle
=
calcTextareaHeight
(
this
.
$refs
.
textarea
,
minRows
,
maxRows
,
options
);
},
},
handleFocus
(
event
)
{
handleFocus
(
event
)
{
this
.
$emit
(
'
focus
'
,
event
);
this
.
$emit
(
'
focus
'
,
event
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment