zoukankan      html  css  js  c++  java
  • ElementUI 修改默认样式

    ElementUI 是一套ui组件库,在项目开发中,难免遇到要需求修改其默认样式的情况,本文就vue 框架介绍几种修改 ElementUI 默认样式的办法。

    1、安装

    • 安装
    npm i element-ui -S
    
    • 使用
    import Vue from 'vue';
    import ElementUI from 'element-ui';
    import 'element-ui/lib/theme-chalk/index.css';
    import App from './App.vue';
      
    Vue.use(ElementUI);
      
    new Vue({
     el: '#app',
     render: h => h(App)
    });
    

    2、修改样式

    一、内嵌法修改样式

    通过 :style 修改,用于局部组件块

    <el-button :style="selfstyle">默认按钮</el-button>
    <script>
     export default {
     data() {
      return {
      selfstyle: {
       color: "white",
       marginTop: "10px",
        "100px",
       backgroundColor: "cadetblue"
      }
      };
     }
     }
    </script>
    

    二、class引用修改样式

    通过 :class 修改,用于局部组件块

    <el-button :class="[selfbutton]">默认按钮</el-button>
    <script>
     export default {
     data() {
      return {
      selfbutton: "self-button"
      };
     }
     }
    </script>
    <style lang="stylus" rel="stylesheet/stylus" scoped>
     .self-button {
     color: white;
     margin-top: 10px;
      100px;
     background-Color: cadetblue;
     }
    </style>
    

    三、import导入修改样式

    通过 import 导入样式文件,若在 main.js 中导入css 则表示全局引用。既可以用于局部组件块也可以用于全局组件

    <el-button>和下面的el-button效果一样</el-button>
    <el-button :class="[selfbutton]">默认按钮</el-button>
    <script>
     import './button.css'
     export default {
     }
    </script>
    <style lang="stylus" rel="stylesheet/stylus" scoped>
    </style>
    
    /* button.css */
    .el-button {
     color: white;
     margin-top: 10px;
      100px;
     background-Color: cadetblue;
    }
      
    .self-button {
     color: white;
     margin-top: 10px;
      100px;
     background-Color: cadetblue;
    }
      
    .self-button:hover {
     color: black;
     background-Color: whitesmoke;
    }
    

    文章链接: https://www.jb51.net/article/192026.htm

  • 相关阅读:
    VS2013连接SQLSERVER数据库时显示无法添加数据连接
    线段树模板
    网格中的极大子矩形的另类解法
    斜率优化
    三维前缀和
    Math Magic ZOJ
    01背包 多重背包 完全背包模板记录
    多重背包的单调队列优化
    Largest Rectangle in a Histogram POJ
    Game with string CodeForces
  • 原文地址:https://www.cnblogs.com/zhaoxxnbsp/p/14694487.html
Copyright © 2011-2022 走看看