<h3>크기를 조절해 보세요!</h3>
<div id="app">
  <textarea 
    ref="targetElement"
    :style="{ lineHeight: `${height}px` }"
    readonly>{{ width }} x {{ height }}</textarea>
</div>
textarea {
  width: 300px;
  height: 200px;
  border: 4px solid;
  outline: none;
  text-align: center;
  font-size: 20px;
  font-weight: 700;
}
// In general, you need polyfill,
// The recommended module is 'https://github.com/juggle/resize-observer'.

// import ResizeObserver from '@juggle/resize-observer'

new Vue({
  el: '#app',
  data () {
    return {
      width: 0,
      height: 0
    }
  },
  mounted () {
    this.observeSize()
  },
  methods: {
    observeSize () {
      const ro = new ResizeObserver(entries => {
        entries.forEach(entry => {
          const { width, height } = entry.contentRect
          this.width = width
          this.height = height
        })
      })
      
      ro.observe(this.$refs.targetElement)
    }
  }
})
View Compiled

External CSS

This Pen doesn't use any external CSS resources.

External JavaScript

  1. https://cdnjs.cloudflare.com/ajax/libs/vue/2.6.10/vue.min.js