我使用TypeScript创建了一个vue组件,并在
和在
Property 'xxx' does not exist on type 'CombinedVueInstance>>'.
例如:
33:18 Property 'open' does not exist on type 'CombinedVueInstance>>'. 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)
此错误还显示任何时间
使用了。
这是组件:
import Vue from 'vue'; import axios from 'axios' export default Vue.extend({ data: function () { return { open: false computed: { profilePath: function () { return "/user/" + this.$store.state.profile.profile.user.id methods: { toggle: function () { this.open = !this.open if (this.open) { // Add click listener to whole page to close dropdown document.addEventListener('click', this.close)