Sha256: c5feb6e976dca43f8f607e2db42cd4df3d8c80b501d196bdd1cccbfd0e6c7336
Contents?: true
Size: 847 Bytes
Versions: 3
Compression:
Stored size: 847 Bytes
Contents
import { CocoComponent } from "@assets/js/base/coco"; export default CocoComponent("seamlessTextarea", () => { return { height: null, observer: null, value: null, options: ["multiline", "focus"], init() { this.value = this.$refs.textarea.value; this.$nextTick(() => { this.onResize(); if (this.$options.focus) { this.$refs.textarea.focus(); this.$refs.textarea.selectionStart = this.$refs.textarea.value.length; } }); }, onResize() { const textarea = this.$refs.textarea; if (textarea) { textarea.style.height = "4px"; const newHeight = textarea.scrollHeight; textarea.style.height = `${newHeight}px`; if (this.height !== newHeight) { this.height = newHeight; } } }, }; });
Version data entries
3 entries across 3 versions & 1 rubygems