vue Answer 3

How to retain the template HTML comment when it renders the template vue

In the official website said, comments When set to true, will be retained and rendering HTML comments in the template. The default behavior is to discard them.

Vue.observable ()

With the refinement of components, multi-component states will encounter shared, Vuex course, these problems can be solved, but as Vuex official document said, if the application is not big enough to avoid redundancy code is cumbersome, it is best Do not use it, and today we introduce a new addition vue.js 2.6 Observable API, by using this api we can deal with the situation a few simple cross-component data sharing state.

vue handling of border

https://www.jianshu.com/p/09e31bac0054

Examples of how to access the parent component in the subassembly

The first method is a method in the subassembly to call the parent component by direct this. $ Parent.event of

The second method is to use the sub-assembly in $emita trigger event to a parent component, the parent component listens to this event on the line.

The third is the parent component sub-assembly method passed, the sub-assembly in calling this method directly

If the project methods vue method defined function result happens by arrow

If the VUE methods inside the object function causes the function to use the arrow does not point to this example $ vue VM, but a xxxx.a a class, try not to VUE fields defined functions which use the arrow

How to configure favicon in vue project

favicon icon configuration is also very simple, vue-cli default to help us install html-webpack-plugin (if not, you can install your own npm), we simply add favicon option in the html-webpack-plugin plugin. html-webpack-plugin plugins need to configure the two, one is to configure the development environment, is another configuration in the environment after the package, if only configure the development environment, the package is not configured after the environment, causing results that is, when the project will be run locally after favicon icon pack found no favicon icon on the server
vue common error handling

https://blog.csdn.net/zn740395858/article/details/80486179

Note the difference event.currentTarget and event.target when getting objects in the vue.

event.currentTarget pointing element event bound, and event.target always point to the elements when the event occurred.

vue force a refresh

1. Use this. $ ForceUpdate forced to re-render

2. v-if instruction

vue why there can be only one root element

In order for a component capable of generating normal vue example, then this will be naturally processed div entry into the program.

Through this 'root' to all the nodes in the recursive traversal throughout VUE 'tree', and the processing is VDOM, finally rendered into a real HTML, is inserted in the correct position

Then the entrance, is the 'root' of this tree, the individual sub-elements, the sub-assembly, the tree is 'leaves', and naturally, tree 'tree' refers to an example of vue

 

Practice vue selection: {

vue project directory

ui frame selection

main.js processing

second package axios

  • Split management routing module
  • Interactive Method

  • Character filtering
  • Global Management

}
VUE variable names if _, $ attribute the beginning of what problems

Will complain, internal vue is so used

v-once usage scenarios which

After changing the time does not change, seen as static content

 

 

Guess you like

Origin www.cnblogs.com/teahouse/p/11301328.html