VUE (三)element-ui

骑猪看日落 2021-12-12 20:09 288阅读 0赞

1.引入element

在项目文件夹下shift+鼠标右键打开命令窗口

执行:

  1. npm i element-ui -S

2019071217220035.png

2.配置main.js

watermark_type_ZmFuZ3poZW5naGVpdGk_shadow_10_text_aHR0cHM6Ly9ibG9nLmNzZG4ubmV0L3FxXzQwMzY5OTQ0_size_16_color_FFFFFF_t_70

  1. import Vue from 'vue'
  2. import App from './App.vue'
  3. import router from './components/router/idnex'
  4. import Element from 'element-ui'
  5. import 'element-ui/lib/theme-chalk/index.css'
  6. Vue.use(Element, { size: 'small' })
  7. Vue.config.productionTip = false
  8. new Vue({
  9. render: h => h(App),
  10. router
  11. }).$mount('#app')

3.修改index.vue

  1. <template>
  2. <div class="hello">
  3. <router-link to="/Login">登录</router-link>
  4. <h1>{
  5. { msg }}</h1>
  6. <h2>Essential Links</h2>
  7. <el-button>默认按钮</el-button>
  8. <el-button type="primary">主要按钮</el-button>
  9. <el-button type="text">文字按钮</el-button>
  10. </div>
  11. </template>
  12. <script>
  13. export default {
  14. name: 'hello',
  15. data () {
  16. return {
  17. msg: 'Welcome to Your Vue.js App'
  18. }
  19. }
  20. }
  21. </script>
  22. <!-- Add "scoped" attribute to limit CSS to this component only -->
  23. <style scoped>
  24. h1, h2 {
  25. font-weight: normal;
  26. }
  27. ul {
  28. list-style-type: none;
  29. padding: 0;
  30. }
  31. li {
  32. display: inline-block;
  33. margin: 0 10px;
  34. }
  35. a {
  36. color: #42b983;
  37. }
  38. </style>

4.效果

watermark_type_ZmFuZ3poZW5naGVpdGk_shadow_10_text_aHR0cHM6Ly9ibG9nLmNzZG4ubmV0L3FxXzQwMzY5OTQ0_size_16_color_FFFFFF_t_70 1

发表评论

表情:
评论列表 (有 0 条评论,288人围观)

还没有评论,来说两句吧...

相关阅读