2、引入js
<!-- import Vue before Element --> <script src="http://www.likecs.com/vue.min.js"></script> <!-- import JavaScript --> <script src="http://www.likecs.com/element-ui/lib/index.js"></script>3、编写html
<div> <el-button @click="visible = true">Button</el-button> <el-dialog :visible.sync="visible" title="Hello world"> <p>Try Element</p> </el-dialog> </div>关于.sync的扩展阅读
https://www.jianshu.com/p/d42c508ea9de4、编写js
<script> new Vue({ el: '#app', data: function () {//定义Vue中data的另一种方式 return { visible: false } } }) </script>06-element-ui.html
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta content="width=device-width, initial-scale=1.0"> <title>Document</title> <!-- import CSS --> <link href="http://www.likecs.com/element-ui/lib/theme-chalk/index.css"> <!-- import Vue before Element --> <script src="http://www.likecs.com/vue.min.js"></script> <!-- import JavaScript --> <script src="http://www.likecs.com/element-ui/lib/index.js"></script> </head> <body> <div> <el-button @click="visible = true">Button</el-button> <el-dialog :visible.sync="visible" title="Hello world"> <p>Try Element</p> </el-dialog> </div> <script> new Vue({ el: '#app', data: function () {//定义Vue中data的另一种方式 return { visible: false } } }) </script> </body> </html>