I am using Nuxt 2.8.1 with typescript 3.4. When I create a component, and define "validate" for that page, I can't access es6 properties defined on the class:
@Component
class Foo extends Vue {
get foo (): boolean { return true }
validate () {
return this.foo // returns undefined?
}
}
[NB: Validate is not passed a Vue instance. At the very least, tooling should error if this for validate is not actually a Foo instance.]
How should I access foo?
UPDATE Ok ... (thanks @Mohan for question) the real problem here is that (being a nuxt/vue newbie), I was defining a vue file in pages, and thought that all vue files are components. However, a page is not a component. (I guess @Page decorator would be nice to support class-based pages.) But the moral of the story is that pages don't have class-based support, and thus isn't weird that validate() is not called with the "component instance".
thiscontext is dependent on how the method is invoked. Is it you who invokevalidate? If not - how exactly that is called? What are the requirements for that method set by a caller? - zerkms