From 3b285f088f28525baa41110aaab0fdf3c03d2870 Mon Sep 17 00:00:00 2001 From: izerozlu Date: Fri, 30 Aug 2019 17:40:39 +0300 Subject: [PATCH] textareaAutoResize directive added and applied to textareas. --- directives/textareaAutoHeight.js | 8 ++++++++ pages/index.vue | 12 ++++++++---- 2 files changed, 16 insertions(+), 4 deletions(-) create mode 100644 directives/textareaAutoHeight.js diff --git a/directives/textareaAutoHeight.js b/directives/textareaAutoHeight.js new file mode 100644 index 000000000..10a566ac5 --- /dev/null +++ b/directives/textareaAutoHeight.js @@ -0,0 +1,8 @@ +export default { + name: "textareaAutoHeight", + update(element) { + if (element.scrollHeight !== element.clientHeight) { + element.style.minHeight = `${element.scrollHeight}px`; + } + } +} diff --git a/pages/index.vue b/pages/index.vue index af4e1bd9e..3c56eebcc 100644 --- a/pages/index.vue +++ b/pages/index.vue @@ -66,12 +66,12 @@
- +
@@ -126,7 +126,7 @@ @@ -154,7 +154,7 @@ @@ -194,6 +194,7 @@