Answers for "vue.createapp"

0

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 + " !";
        	}
        }
        
});
Posted by: Guest on June-30-2021
0

how use vue createApp

const app = Vue.createApp({
  data() {
    return { count: 4 }
  }
})

const vm = app.mount('#app')

console.log(vm.count) // => 4
Posted by: Guest on May-19-2021

Code answers related to "vue.createapp"

Code answers related to "Javascript"

Browse Popular Code Answers by Language