support changing textarea height automatically in account/category edit page

This commit is contained in:
MaysWind
2021-02-06 16:35:08 +08:00
parent 6839fe89a6
commit 84f6883e71
2 changed files with 34 additions and 0 deletions
+15
View File
@@ -66,6 +66,8 @@
<f7-list-input
type="textarea"
class="textarea-auto-size"
style="height: auto"
:placeholder="$t('Your category description (optional)')"
:value="category.comment"
@input="category.comment = $event.target.value"
@@ -185,6 +187,9 @@ export default {
self.loading = false;
}
},
updated: function () {
this.autoChangeCommentTextareaSize();
},
methods: {
save() {
const self = this;
@@ -235,6 +240,16 @@ export default {
self.$toast(error.message || error);
}
});
},
autoChangeCommentTextareaSize() {
const app = this.$f7;
const $$ = app.$;
$$('.textarea-auto-size textarea').each((idx, el) => {
el.scrollTop = 0;
el.style.height = '';
el.style.height = el.scrollHeight + 'px';
});
}
}
}