Last active
June 20, 2021 01:51
-
-
Save titusdecali/d82f85326e9b61dafec93a5d102f7b54 to your computer and use it in GitHub Desktop.
Vue: Access data in $parent from child
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// In parent | |
data() { | |
return { | |
message: 'This is my message' | |
} | |
} | |
// In child template | |
<div>{{ $parent.message }}</div> // <-- results in 'This is my message' | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment