1. What are the ways of vUE route jump and parameter transfer?

1Router-link (); router-link (); router-link (); --> <router-link to='/testDemo'< p style = "padding-bottom: 0px; padding-bottom: 0px2</button> </router-link> <! --> <router-link :to="{path:'testDemo',query:{setid:123456}}"< p style = "padding-bottom: 0px; padding-bottom: 0px1</button>
</router-link>
 
<router-link :to="{name:'testDemo',params:{setid:1111222}}"< p style = "padding-bottom: 0px; padding-bottom: 0px3</button>
</router-link>

<router-link to="/HH? setid=123qq"> Jump to HelloVue</router-link> Pass multiple parameters in the work array as followsidTitle img, etc. <router-link tag="aa" :to="{path:'/ target path ',query:{arry:work}}">
export default{
  data(){
      return{work:[],}}} Create (){this.work=this.$route.query.arry; }2<template> <divid='test'>
       <button @click='goTo()'> Click jump4</button>
   </div>
</template>
<script>
   export default{
       name:'test', methods:{goTo(){$router. Push (){'/testDemo'); $router. Push ({path:'/testDemo',query:{setid:123456}});
               this.$router.push({name:'testDemo',params:{setid:111222}}); }}} </script> Create (){this.id=this.$route.params.orderId;
       console.log(this.id)}Copy the code

What is a closure? What are the pros and cons?

Closures are functions that can read variables inside other functions. In javascript, for example, local variables can only be read by child functions inside a function, so closures can be understood as "functions defined inside a function." In essence, closures are Bridges that connect the inside and outside of a function. Features: Function nested function. Functions can reference external parameters and variables inside. Parameters and variables are not collected by the garbage collection mechanism. Advantages: You want a variable to be stored in memory for a long time. Avoid contamination of global variables. Private members exist. Disadvantages: Resident memory, increase memory usage. Improper use can easily cause memory leaks.Copy the code

3. Have you used VueX (Vue state management mode)?

  • State Storage status

  • Mutations State member operation

  • Getters processes state members to the outside world

  • Actions Asynchronous operations

  • Modules Modularization status management

    www.jianshu.com/p/2e5973fe1…

4. Use CSS to draw trigonometry?

  • Triangle implementation principle: width is 0; The height of 0; (1) There is a horizontal and vertical border (up, down, left and right) set as border- direction: length solid red, this is the line at the bottom. For other edges, use border- Direction: length solid transparent. (2) If the hypotenuse is on the right side of the triangle, set the top or bottom line and the right slash. If the hypotenuse is on the left side of the triangle, set the top or bottom line and the left slash.
.triangle-up {
  width: 0;
  height: 0;
  border-left: 50px solid transparent;
  border-right: 50px solid transparent;
  border-bottom: 100px solid red;
}
Copy the code