Learn eight declared periodic functions

BeforeCreate () {// Functions are automatically executed before instance creation}, created() {// functions are automatically executed after instance creation}, beforeMount() {// Functions are automatically executed before component content is rendered to the page}, Mounted () {// Automatically execute functions after component content is rendered to the page}, beforeUpdate() {// Automatically execute functions after data changes on the page}, updated() {// Automatically execute functions after component content is rendered to the page}, beforeUpdate() {// Automatically execute functions after data changes on the page}, Auto-execute functions}, beforeUnmount(){// Auto-execute functions} when Vue application fails, Unmount(){// When Vue application fails and after DOM is completely destroyed. Autoexecute function}Copy the code

Second, properties,

data & metgods & computend & watcher

One of the things that you can do with both computed and Method is to use computed because you have caching and you can do with both computed and Watcher and you can use computed because it’s much simpler

// use methods(){} to calculate when the content of a calculated attribute changes. // Computend (){} // watch:{//prev, Price (current,prev){}}Copy the code

Third, style binding

Class ="$attrs.class" // Inline style=""Copy the code

Four, instructions,

// Conditional statements must be next to each other v-if v-else if V-else // Show and hide as v-if, but hide instead of dom destruction V-show // bind statement instructions used to bind values V-bind V-model // Loop render V-for ="item in list" or V-for (item,index) in list V -for(value,key,index) in list if some values are the same during the loop, use :key="index" to bind a unique key, which can be reused to improve vUE performanceCopy the code

5. Modifier

If the first div has @click and the second div has @click then both will be executed. If you don't want the first div to do click, either put @click.stop on the second one or @click.self on the first oneCopy the code
Copy the code
Copy the code
Copy the code
Copy the code
Copy the code