From e1dce2c5af692ee8938e0c308df3e5bb66b5634c Mon Sep 17 00:00:00 2001 From: Henry Jameson Date: Sun, 15 Apr 2018 19:05:16 +0300 Subject: [PATCH] better approach --- src/components/post_status_form/post_status_form.js | 13 +++++++++---- .../post_status_form/post_status_form.vue | 2 +- 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/src/components/post_status_form/post_status_form.js b/src/components/post_status_form/post_status_form.js index c63c308c..5e59b0e8 100644 --- a/src/components/post_status_form/post_status_form.js +++ b/src/components/post_status_form/post_status_form.js @@ -28,6 +28,10 @@ const PostStatusForm = { components: { MediaUpload }, + mounted () { + console.log(this.$refs) + this.resize(this.$refs.textarea) + }, data () { let statusText = '' @@ -235,10 +239,11 @@ const PostStatusForm = { e.dataTransfer.dropEffect = 'copy' }, resize (e) { - e.target.style.height = 'auto' - e.target.style.height = `${e.target.scrollHeight - 10}px` - if (e.target.value === '') { - e.target.style.height = '16px' + const target = e.target || e + target.style.height = 'auto' + target.style.height = `${target.scrollHeight - 10}px` + if (target.value === '') { + target.style.height = '16px' } }, clearError () { diff --git a/src/components/post_status_form/post_status_form.vue b/src/components/post_status_form/post_status_form.vue index 4107522d..88627e3a 100644 --- a/src/components/post_status_form/post_status_form.vue +++ b/src/components/post_status_form/post_status_form.vue @@ -3,6 +3,7 @@