Skip to content

Instantly share code, notes, and snippets.

@TuVanDev
Created August 11, 2024 19:19
Show Gist options
  • Save TuVanDev/ee8ea5cb3f6a18338b5b62f4aeee21b2 to your computer and use it in GitHub Desktop.
Save TuVanDev/ee8ea5cb3f6a18338b5b62f4aeee21b2 to your computer and use it in GitHub Desktop.
<div id="vue-test">
<h1>Loading message...</h1>
</div>
<script>
require (['vue'], function(Vue) {
'use strict'
new Vue({
el: '#vue-test',
data: {
message: 'This is a test'
},
mounted() {
// Replace the content of the h1 element with the Vue message
const vueContentPlaceholder = document.querySelector('#vue-test h1');
vueContentPlaceholder.textContent = this.message;
}
});
})
</script>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment