How is the component code on the element-ui, page recognized and replaced with HTML?

<!DOCTYPE html>
<html>
<head>
  <meta charset="UTF-8">
  <!-- import CSS -->
  <link rel="stylesheet" href="https://unpkg.com/element-ui/lib/theme-chalk/index.css">
</head>
<body>
  <div id="app">
    <el-button @click="visible = true">Button</el-button>
    <el-dialog :visible.sync="visible" title="Hello world">
      

Try Element

</el-dialog> </div> </body> <!-- import Vue before Element --> <script src="https://unpkg.com/vue/dist/vue.js"></script> <!-- import JavaScript --> <script src="https://unpkg.com/element-ui/lib/index.js"></script> <script> new Vue({ el: "-sharpapp", data: function() { return { visible: false } } }) </script> </html>

novice, at the beginning of the technical rehearsal of vue-related technology, take a look at the above elementui, is an official example of directly referring to js and css (npm method has been understood, but shielded too many underlying principles), I have the following questions:
1, vue components generally have template code, the above examples only cite element js and css, so where is template? This took a look at the js code, it seems that there is code to deal with HTML css, guess it is in index.js.
2. How does element get through to vue? According to the previous practice of components or plug-ins, at least there must be code such as vue.component,vue.use. The above example does not, but refers to the fact that index.css and index.js, can resolve < el-button.

Mar.19,2021

The components of

1.vue are divided into several ways: DOM template, string template, single file component, etc. The above example has parsed compile < el-button > < / el-button > through the principle of new Vue (.) instantiating vue,vue, abstracted as AST (abstract syntax tree), and finally needs to get render function to render it. For this piece of
principle, you can refer to the detailed source code parsing of others. Vue source code learning

The index.js in

2.element is a packaged and compiled file. In fact, the ElementUI is registered globally through Vue.use .


try to see the source code first, and then read it several times and you will understand

.
Menu