Home > Web Front-end > Front-end Q&A > What does mounting mean in vuejs

What does mounting mean in vuejs

青灯夜游
Release: 2023-01-11 09:22:43
Original
4913 people have browsed it

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>
Copy after login

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>
Copy after login

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!

Related labels:
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template