The process of establishing a relationship between the virtual dom and the real dom and letting the Vue instance control a certain area in the page is called mounting. The mounting methods are: 1. Configure through the "el:'css selector'" statement; 2. Configure through the "Vue instance.$mount("css selector")" statement.
The operating environment of this tutorial: windows7 system, vue2.9.6 version, DELL G3 computer.
The word mount comes from the concept of the operating system. Its original meaning is to establish a relationship between the virtual file system and the hardware driver. By operating the virtual file system, the real file is indirectly operated. For example, the essence of USB disk operation is to establish a mapping relationship with real USB disk files through the virtual file system. The addition, deletion, modification and checking of files operated by the user are all for the virtual file directory, and the virtual file system will handle the real file operations.
The process of establishing a relationship between the real file system of the USB disk and the virtual file system is called mounting.
Back to the browser, the process of establishing a relationship between the virtual dom and the real dom can also be called mounting. Because both "virtual" and "real" are connected, the user operates the "virtual" part.
So what does the mount mentioned in vue mean?
The process of letting a Vue instance control a certain area in the page is called mounting.
Mounting method:
1. Configure through `el: "css selector"
<body> <div id="app"></div> <!-- built files will be auto injected --> </body> <script> new Vue({ el: '#app' }) </script>
Create Mount Vue
2. Configure it through Vue instance.$mount("css selector")
<body> <div id="app"></div> <!-- built files will be auto injected --> </body> <script> new Vue({ ... }) Vue.$mount("#app"); </script>
Mount after creating Vue
$
The function is to distinguish the data names in Vue instances with the same names (to prevent duplicate names)
Related recommendations: "vue.js Tutorial 》
The above is the detailed content of What does mounting mean in vuejs. For more information, please follow other related articles on the PHP Chinese website!