mirror of
https://github.com/ArthurDanjou/ui.git
synced 2026-01-17 05:28:09 +01:00
feat(Textarea): add maxrows prop to restrict autoresize (#1302)
Co-authored-by: Benjamin Canac <canacb1@gmail.com>
This commit is contained in:
@@ -66,6 +66,10 @@ export default defineComponent({
|
||||
type: Number,
|
||||
default: 3
|
||||
},
|
||||
maxrows: {
|
||||
type: Number,
|
||||
default: 0
|
||||
},
|
||||
autoresize: {
|
||||
type: Boolean,
|
||||
default: false
|
||||
@@ -160,7 +164,7 @@ export default defineComponent({
|
||||
const newRows = (scrollHeight - padding) / lineHeight
|
||||
|
||||
if (newRows > props.rows) {
|
||||
textarea.value.rows = newRows
|
||||
textarea.value.rows = props.maxrows ? Math.min(newRows, props.maxrows) : newRows
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user