vue el-descriptions 样式问题

设置label固定长度使用这个

label-class-name="my-label"
.my-label {
  width: 145px;
}

设置显示数据长度使用这个

content-class-name="my-con"
.my-con {
  width: 500px;
}

给label设置固定颜色,或者判断某个使用单独样式

:label-class-name="index == 1 ? 'my-label' : ''"
.my-label {
  background: #ecf6fe !important;
}
  • 1
    点赞
  • 4
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
Vueel-descriptions组件并不直接支持可编辑功能,但你可以通过结合其他组件和事件来实现这个功能。以下是一个示例: ```html <template> <div> <el-descriptions :border="false" :column="1"> <el-descriptions-item label="姓名"> <template v-if="!isEditingName">{{ name }}</template> <template v-else> <el-input v-model="editedName"></el-input> </template> <el-button type="text" icon="el-icon-edit" @click="toggleEdit('name')"></el-button> </el-descriptions-item> <el-descriptions-item label="年龄"> <template v-if="!isEditingAge">{{ age }}</template> <template v-else> <el-input v-model="editedAge"></el-input> </template> <el-button type="text" icon="el-icon-edit" @click="toggleEdit('age')"></el-button> </el-descriptions-item> </el-descriptions> </div> </template> <script> export default { data() { return { name: '张三', age: 25, editedName: '', editedAge: '', isEditingName: false, isEditingAge: false }; }, methods: { toggleEdit(field) { if (field === 'name') { if (this.isEditingName) { this.name = this.editedName; } this.isEditingName = !this.isEditingName; } else if (field === 'age') { if (this.isEditingAge) { this.age = this.editedAge; } this.isEditingAge = !this.isEditingAge; } } } }; </script> ``` 在上面的示例中,我们使用了el-descriptions组件来展示姓名和年龄的信息。通过点击编辑按钮,可以切换到编辑模式,然后使用el-input组件来编辑对应的字段。点击编辑按钮时,会触发toggleEdit方法,该方法会切换编辑状态并保存编辑后的值。

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值