el-select 如何修改样式

207 阅读1分钟

本篇博客就讨论宽高该如何修改

1. 宽

宽很修改,直接el-select 加行内样式

    <el-select v-model="model" placeholder="placeholder"  style="width: 180px;">  
      <el-option  
          v-for="item in optionsList"  
          :key="item.value"  
          :label="item.label"  
          :value="item.value"  
      >  
      </el-option>  
    </el-select>

2. 高

高不能通过简单的行内样式修改,下面的代码还是基于上方的html代码 首先打开f12,查看el-select在控制台显示的样式名称,之后采取下面任意一种方法

2.1. 法一

使用scope语法

<style scoped>  
:deep(.el-select__wrapper){  
  height: 100px;  
}  
</style>

2.2. 法二

不使用scope语法

<style>  
.el-select__wrapper{  
  height: 100px;  
}  
</style>