koca/vue-prism-editor

setLineNumbersHeight 函数中 this.$refs.pre 会存在 undefined的情况

xyzgy opened this issue · 1 comments

xyzgy commented
Uncaught (in promise) TypeError: Failed to execute 'getComputedStyle' on 'Window': parameter 1 is not of type 'Element'.
    at Proxy.setLineNumbersHeight (Editor.ts:147)
    at Proxy.<anonymous> (Editor.ts:111)

修改为

 setLineNumbersHeight(): void {
      this.$nextTick(()=>{
        this.lineNumbersHeight = getComputedStyle(this.$refs.pre as HTMLTextAreaElement).height;
      })
    },

did you find a solution?