Created
June 19, 2018 02:37
-
-
Save rg3915/0e22c9041776a4b083ae79fd26be8b39 to your computer and use it in GitHub Desktop.
VueJS ref and data example
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
<div id="app"> | |
<span data-pk='42' ref="mySpan">Meu span maneirasso</span> | |
<h2> | |
{{textMySpan}} | |
</h2> | |
</div> | |
new Vue({ | |
el: "#app", | |
data: { | |
textMySpan: '' | |
}, | |
mounted(){ | |
this.textMySpan = this.$refs.mySpan.dataset.pk | |
} | |
}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment