Created
December 8, 2019 23:46
-
-
Save kklecho/e8fbcfe0164f4e31637ea36a78c1caf3 to your computer and use it in GitHub Desktop.
This file contains 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
#assets/js/components/App.vue | |
<template> | |
<div> | |
<h2 class="center">My Application</h2> | |
<div v-text="message"></div> | |
{{ message }} | |
<ul> | |
<li :key="word.id" v-for="word in words">{{ word }}</li> | |
</ul> | |
</div> | |
</template> | |
<script> | |
export default { | |
data() { | |
return { | |
message: "A list of words", | |
words: [] | |
}; | |
}, | |
mounted() { | |
let el = document.querySelector("div[data-words]"); | |
let mywords = el.dataset.words.split(","); | |
this.words.push.apply(this.words, mywords); | |
} | |
}; | |
</script> | |
<style> | |
.center { | |
text-align: center; | |
} | |
</style> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment