<!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.