【问题标题】:How fix Object is of type 'unknown'?如何修复“未知”类型的对象?
【发布时间】:2022-01-05 06:26:56
【问题描述】:

如何修复“未知”类型的对象?

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

【问题讨论】:

    标签: typescript vue.js


    【解决方案1】:

    尝试按如下方式转换引用的元素:

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

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2022-01-24
      • 2021-05-14
      • 2022-01-21
      • 1970-01-01
      • 2020-04-12
      • 2019-12-16
      • 1970-01-01
      • 2021-11-16
      相关资源
      最近更新 更多