element-ui组件中,文件上传按钮是由el-upload控制的,普通的按钮是el-button,在使用时,如果不加以修饰,往往会分两行的形式存在,如图:
在这里插入图片描述代码如下:

  <el-row class="padding-10-0">
    <el-upload
        :on-success="handleSuccess"
        :show-file-list="false"
        :before-upload="handleBeforeUpload"
        :on-progress="handleProgress"
        :data="{id: nodeId}"
        action="/budget/adjustment/constructProject/otherRateFile">
      <el-button type="default" size="small">导入EXCEL</el-button>
      </el-upload>
      <el-button type="default" size="small">样表下载</el-button>
    </el-row>

虽然直观的看起来是在同一个el-row中,但是结果却不尽人意。
如果想要变成同一行,如下所示:
在这里插入图片描述可以直接在el-uopload组件中加上自己的CSS样式控制

.inline-block {
  display: inline-block;
}

然后将这个样式放在class中,即可

 <el-row class="padding-10-0">
    <el-upload
        class="upload-demo inline-block margin-right-10"
        :on-success="handleSuccess"
        :show-file-list="false"
        :before-upload="handleBeforeUpload"
        :on-progress="handleProgress"
        :data="{id: nodeId}"
        action="/budget/adjustment/constructProject/otherRateFile">
      <el-button type="default" size="small">导入EXCEL</el-button>
      </el-upload>
      <el-button type="default" size="small">样表下载</el-button>
    </el-row>

这个display中的inline-block就是控制上传组件不换行的样式


the end
good lunck

GitHub 加速计划 / eleme / element
14
2
下载
A Vue.js 2.0 UI Toolkit for Web
最近提交(Master分支:2 个月前 )
c345bb45 1 年前
a07f3a59 * Update transition.md * Update table.md * Update transition.md * Update table.md * Update transition.md * Update table.md * Update table.md * Update transition.md * Update popover.md 1 年前
Logo

新一代开源开发者平台 GitCode,通过集成代码托管服务、代码仓库以及可信赖的开源组件库,让开发者可以在云端进行代码托管和开发。旨在为数千万中国开发者提供一个无缝且高效的云端环境,以支持学习、使用和贡献开源项目。

更多推荐