If you meant to access the Vue Instance then,

`this` equals undefined in a lot of different times, e.g. in beforeCreate lifecycle, beforeRouteEnter router hooks.

Also, using `this` in Vue template, like the following:

<div @click=”this.click”></div>

…would give a ReferenceError, since `this` won’t ever point to the instance scope. Reason why, if you look at how vue-template-compiler works, you see that Vue passes the instance scope using `with(this){…}` function.

So, `this.click` in above template would simply equals to `this[‘this.click’]`.

--

Front-End Developer. Bandung, Indonesia.

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store