将vue和element-ui写在一个html里面方便调试(小白篇)
声明:纯属小白进门文档
vue的官方文档:
https://vuejs.bootcss.com/v2/guide/
第一步:引入vue.js
<script src="https://cdn.jsdelivr.net/npm/vue/dist/vue.js"></script>
第二步:复制粘贴vue官方文档的实例后打开浏览器运行查看结果
完整html如下,可直接复制粘贴:
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <meta http-equiv="X-UA-Compatible" content="ie=edge"> <title>Document</title> <script src="https://cdn.jsdelivr.net/npm/vue/dist/vue.js"></script> </head> <body> <div id="app"> {{ message }} </div> <script> var app = new Vue({ el: '#app', data: { message: 'Hello Vue!' } }) </script> </body> </html>
element-ui(配合vue的一款非常优秀的ui框架)的官方文档,来展示效果
官方文档:http://element-cn.eleme.io/#/zh-CN/component/badge
第一步:引入
<!-- 引入样式 --> <link rel="stylesheet" href="https://unpkg.com/element-ui/lib/theme-chalk/index.css">
<!-- 引入组件库 --> <script src="https://unpkg.com/element-ui/lib/index.js"></script>
第二步:
举个栗子:比如 Badge 标记 组件
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <meta http-equiv="X-UA-Compatible" content="ie=edge"> <title>Document</title> <script src="https://cdn.jsdelivr.net/npm/vue/dist/vue.js"></script> <!-- 引入样式 --> <link rel="stylesheet" href="https://unpkg.com/element-ui/lib/theme-chalk/index.css"> <!-- 引入组件库 --> <script src="https://unpkg.com/element-ui/lib/index.js"></script> <style> .item { margin-top: 10px; margin-right: 40px; } </style> </head> <body> <div id="app"> <div> {{ message }}</div> <div> <el-badge :value="12" class="item"> <el-button size="small">评论</el-button> </el-badge> <el-badge :value="3" class="item"> <el-button size="small">回复</el-button> </el-badge> <el-dropdown trigger="click"> <span class="el-dropdown-link"> 点我查看 <i class="el-icon-caret-bottom el-icon--right"></i> </span> <el-dropdown-menu slot="dropdown"> <el-dropdown-item class="clearfix"> 评论 <el-badge class="mark" :value="12" /> </el-dropdown-item> <el-dropdown-item class="clearfix"> 回复 <el-badge class="mark" :value="3" /> </el-dropdown-item> </el-dropdown-menu> </el-dropdown> </div> </div> <script> var app = new Vue({ el: '#app', data: { message: 'Hello Vue!' } }) </script> </body> </html>