I am curious about changing the property of a vue app from an external source. I want to create a new vue app named 'app' and set 'app.propertyName' to 'someValue'. However, my attempt below did not yield the desired outcome. How can this be accomplished?
<!DOCTYPE html>
<html>
<head>
<title>Changing Vue App Property</title>
<style>
#app {
display: inline-block;
padding: 10px;
font-size: x-large;
background-color: lightgreen;
}
</style>
</head>
<body>
<h1>'template' Example</h1>
<p>All HTML code inside the div tag with id="app" has been moved within the 'template' configuration option, enclosed in backtick quotes.</p>
<div id="app"></div>
<script src="https://unpkg.com/vue@3/dist/vue.global.js"></script>
<script>
const app = Vue.createApp({
template: `<h1>{{ message }}</h1>
<p>This is a second line of HTML code, wrapped in backticks</p>`,
data() {
return {
message: "Hello World!"
}
}
})
app.mount('#app');
app.message = "My name is Florian"; //This line does not work as intended
</script>
</body>
</html>