大飞_dafei

导航

< 2025年3月 >
23 24 25 26 27 28 1
2 3 4 5 6 7 8
9 10 11 12 13 14 15
16 17 18 19 20 21 22
23 24 25 26 27 28 29
30 31 1 2 3 4 5

统计

Element 设置el-input宽度大小

Element 设置el-input宽度大小

官网暂时没有提供属性方法,需要自己写class样式

复制代码
<template>
  <div>
    <h3>Element:设置el-input宽度大小</h3>
    <div style="width: 500px">
      <el-form :model="widthForm" ref="widthFormRef" inline class="width-form">
        <el-form-item label="姓名" prop="feiName">
          <el-input v-model="widthForm.feiName" placeholder="请输入姓名" clearable />
        </el-form-item>

        <el-form-item label="地址" prop="feiAddress">
          <el-input v-model="widthForm.feiAddress" placeholder="请输入地址" clearable />
        </el-form-item>

        <el-form-item label="金额" prop="price">
          <el-input-number
              v-model="widthForm.price"
              :precision="2"
              placeholder="请输入金额"
              clearable
          />
        </el-form-item>

        <el-form-item label="行内长度" prop="other">
          <el-input v-model="widthForm.other" placeholder="行内长度" clearable style="width: 150px" />
        </el-form-item>
      </el-form>
    </div>
  </div>
</template>
<script setup>
import {reactive, ref} from "vue";

const useWidthForm = () => {
  const widthFormRef = ref()
  const defaultForm = () => {
    return {
      feiName: undefined,
      feiAddress: undefined,
      price: 0,
      other: undefined,
    }
  }
  const widthForm = reactive(defaultForm())
  return {widthFormRef, widthForm}
}
const {widthFormRef, widthForm} = useWidthForm()
</script>
<style scoped lang="scss">
/* 在这里写行样式 */
.width-form{
  .el-form-item {
    .el-input {
      width: 260px;
    }
    .el-select {
      width: 260px;
    }
    .el-input-number {
      width: 260px;
    }
  }
}
</style>
View Code
复制代码

 

 

posted on   大飞_dafei  阅读(309)  评论(0编辑  收藏  举报

相关博文:
阅读排行:
· 被坑几百块钱后,我竟然真的恢复了删除的微信聊天记录!
· 没有Manus邀请码?试试免邀请码的MGX或者开源的OpenManus吧
· 【自荐】一款简洁、开源的在线白板工具 Drawnix
· 园子的第一款AI主题卫衣上架——"HELLO! HOW CAN I ASSIST YOU TODAY
· Docker 太简单,K8s 太复杂?w7panel 让容器管理更轻松!
点击右上角即可分享
微信分享提示