vue3 render函数方式创建el-select,不能回显是什么问题呢?
const handleRemove = () => {
const options = combination.value.mapList[VariableEnum.variable.toString()] ?? [];
const selected = ref();
const content = h("div", {}, [
h("p", { style: { marginBottom: "12px" } }, "已有变量配置绑定此组合方式,如要删除请选择替换组合方式"),
h(
// ElSelect,
'el-select',
{
// onChange: (val: any) => {
"onUpdate:modelValue": (val: number) => {
selected.value = val;
console.log(selected.value);
},
// value: selected.value,
modelValue: selected.value,
style: { width: "100%" },
placeholder: "请选择替换组合方式",
},
[
options.map((item: any) =>
h(ElOption, {
key: item.id,
label: item.title,
value: item.id,
})
),
]
),
]);
ElMessageBox({
title: "警告",
message: () => content,
}).then(() => {
console.log(selected.value);
// 处理删除逻辑
});
};
找到原因了,conten不是写的函数,这样定义是一个常量了,肯定不会变化了