Skip to content

Instantly share code, notes, and snippets.

@mornir
Created January 10, 2018 17:42
Show Gist options
  • Save mornir/b1fc35a6c06f931eaa59a6789d032041 to your computer and use it in GitHub Desktop.
Save mornir/b1fc35a6c06f931eaa59a6789d032041 to your computer and use it in GitHub Desktop.
//pass vm (name is up to you) to data function in order get access to the present vue instance in nested objects
data: vm => ({
valid: true,
name: '',
email: '',
password: '',
confirmPassword: '',
// in a non nested object, 'this' is enough to access the properties in the data function
/* matchPassword2() {
return this.password === this.confirmPassword || 'Password do not match.'
}, */
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment