day03---Vue(04) (3)

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/d42c508ea9de

4、编写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>

内容版权声明:除非注明,否则皆为本站原创文章。

转载注明出处:https://www.heiqu.com/wspfxd.html