zoukankan      html  css  js  c++  java
  • Vue配置element ui(使用了vue-cli脚手架)笔记

    element-ui 官网安装教程

    安装element-ui

    • npm install element-ui -s

    安装 babel-plugin-component 插件,实现按需导入

    • npm install babel-plugin-component -D
    1. 然后,在.babelrc文件添加如下代码至plugins下:
      [
          "component",
          {
            "libraryName": "element-ui",
            "styleLibraryName": "theme-chalk"
          }
        ]
    

    如图:

    1. 接下来,引用需要的组件
      main.js中写入:
    import { Button } from 'element-ui'
    import 'element-ui/lib/theme-chalk/index.css';
    
    Vue.component(Button.name, Button);
    

    npm run dev 运行时,出现以下报错:

    “You may use special comments to disable some warnings. Use // eslint-disable-next-line to ignore the next line. Use /* eslint-disable */ to ignore all warnings in a file. ”

    修改components下的Hello.vue组件,并成功运行后,如图:

    <template>
      <div class="hello">
        <h1>{{ msg }}</h1>
        <h2>emmm</h2>
        <el-row>
          <el-button type="primary">hello element UI</el-button>
        </el-row>
    
      </div>
    </template>
    
    <script>
    export default {
      name: 'hello',
      data () {
        return {
          msg: 'Welcome to Your Lnuews新闻站点'
        }
      }
    }
    </script>
    
    <!-- Add "scoped" attribute to limit CSS to this component only -->
    <style scoped>
    h1, h2 {
      font-weight: normal;
    }
    ul {
      list-style-type: none;
      padding: 0;
    }
    li {
      display: inline-block;
      margin: 0 10px;
    }
    a {
      color: #42b983;
    }
    </style>
    
    
  • 相关阅读:
    linux 中的vim的配置文件的位置
    centos find
    multi-cursor
    ctrlsf插件
    Vim的可视模式
    Vim的tagbar插件
    Vim的tag系统
    ~/.ctag的作用与配置
    在Vim里使用gtags-cscope
    查看Vim的option变量的值
  • 原文地址:https://www.cnblogs.com/famine/p/11901973.html
Copyright © 2011-2022 走看看