相关疑难解决方法(0)

属性“XXX”在类型“CombinedVueInstance<Vue, {}, {}, {}, Readonly<Record<never, any>>>”上不存在

我创建了一个打字原稿VUE组成部分,我在得到这个错误data(),并在methods()

Property 'xxx' does not exist on type 'CombinedVueInstance<Vue, {},
{}, {}, Readonly<Record<never, any>>>'.
Run Code Online (Sandbox Code Playgroud)

例如:

33:18 Property 'open' does not exist on type 'CombinedVueInstance<Vue, {}, {}, {}, Readonly<Record<never, any>>>'.
    31 |         methods: {
    32 |             toggle: function () {
  > 33 |                 this.open = !this.open
       |                  ^
    34 |                 if (this.open) {
    35 |                     // Add click listener to whole page to close dropdown
    36 |                     document.addEventListener('click', this.close)
Run Code Online (Sandbox Code Playgroud)

此错误还显示任何时间this.close()被使用。

这是组件:

<script lang='ts'>
    import Vue …
Run Code Online (Sandbox Code Playgroud)

javascript typescript vue.js vuejs2

19
推荐指数
9
解决办法
2万
查看次数

标签 统计

javascript ×1

typescript ×1

vue.js ×1

vuejs2 ×1