Home  >  Article  >  Web Front-end  >  What does mounting mean in vuejs

What does mounting mean in vuejs

青灯夜游
青灯夜游Original
2021-09-28 15:10:254853browse

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.

What does mounting mean in vuejs

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: &#39;#app&#39;
})
</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!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn