Home > Net >  How fix Object is of type 'unknown'?
How fix Object is of type 'unknown'?

Time:11-28

How fix Object is of type 'unknown'?

 mounted () {
            this.$nextTick(function () {
              this.$refs.task1.classList.add('increase')
            })

CodePudding user response:

Try to cast the referenced element as follows :


 mounted () {
            this.$nextTick(()=> {
              (this.$refs.task1 as HTMLElement).classList.add('increase')
            })
  • Related