vue3中弹框中的el-select下拉组件显示value而不显示label

1.场景

使用element-ui中的el-select,给选择框赋值时显示的值是value不是label

2.原因分析

3.解决方法

在点击编辑按钮后将获取到的对象中的os属性值改为string类型

html 复制代码
<el-select v-model="form.os" clearable placeholder="请选择" style="width: 100%;">
  <el-option v-for="item in datas.optionsList" :key="item.value" :label="item.label" :value="item.value" />
</el-select>
javascript 复制代码
// 编辑
const editBtn = (row) => {
  console.log('编辑商品', row);
  form.value.serverAddress = row.serverAddress
  form.value.os = String(row.os)
}

4.总结

说白了就是列表中的数据与下拉列表数据中的value值的类型不同,只要改成类型相同就能解决该问题了

相关推荐
万少8 分钟前
Trae AI 编辑器6大使用规则
前端·javascript·人工智能
好玩的Matlab(NCEPU)30 分钟前
如何编写 Chrome 插件(Chrome Extension)
前端·chrome
Yan-英杰35 分钟前
Deepseek大模型结合Chrome搜索爬取2025AI投资趋势数据
前端·chrome
Crystal3281 小时前
app里video层级最高导致全屏视频上的操作的东西显示不出来的问题
前端·vue.js
weixin_445476681 小时前
Vue+redis全局添加水印解决方案
前端·vue.js·redis
lecepin1 小时前
AI Coding 资讯 2025-10-29
前端·后端·面试
余道各努力,千里自同风1 小时前
小程序中获取元素节点
前端·小程序
PineappleCoder1 小时前
大模型也栽跟头的 Promise 题!来挑战一下?
前端·面试·promise
非凡ghost1 小时前
MousePlus(鼠标增强工具) 中文绿色版
前端·windows·计算机外设·软件需求
Moonbit1 小时前
MoonBit Pearls Vol.13:初探 MoonBit 中的 JavaScript 交互
javascript·后端