vuejs 3 app.mount
// HTML file
<body>
<div id="app">
// Your app here
</div>
</body>
// JS file
import { createApp } from 'vue';
import App from './App.vue';
const app = createApp(App);
app.mount('#app');
vuejs 3 app.mount
// HTML file
<body>
<div id="app">
// Your app here
</div>
</body>
// JS file
import { createApp } from 'vue';
import App from './App.vue';
const app = createApp(App);
app.mount('#app');
vue.createapp
const app = Vue.createApp( {
template: "<p>Hello From Vue.createApp</p>", // Custom template for the element the vue app is mounted on
data() { // Items in data are accessible in other functions by using the 'this' keyword
return {
someData = "Hello World",
someObject = { // Can easily access object's values in html template
// with someObject._valueName_
title : "Hi There",
count : 1,
info : "Hola"
}
}
},
mounted() { // Called the first time the Vue app is mounted
console.log(this.someData);
this.someFunc(); // defined in methods::
// can also create a function with 'this' keyword anywhere to make it
//accessible to every other function in the vue app
null;
},
methods: { // Custom functions available to other functions in the vue app by using the 'this' keyword
// Also available to other html elements with some vue specific attributes such as v-on (or @)
someFunc() {
null;
},
someFunc2() {
null;
}
},
computed: { // Functions in the 'computed' property return values that usually depend on the 'data' values
// They are called (in the HTML template) in the same way as the 'data' values
changedData() {
return this.someData + " !";
}
}
});
how use vue createApp
const app = Vue.createApp({
data() {
return { count: 4 }
}
})
const vm = app.mount('#app')
console.log(vm.count) // => 4
Copyright © 2021 Codeinu
Forgot your account's password or having trouble logging into your Account? Don't worry, we'll help you to get back your account. Enter your email address and we'll send you a recovery link to reset your password. If you are experiencing problems resetting your password contact us