fix(cert-plugin): 修复DNS提供商授权无法回显的bug

This commit is contained in:
xiaojunnuo
2026-06-09 23:08:45 +08:00
parent 3e9953a74a
commit 016ae865b1
4 changed files with 15 additions and 7 deletions
View File
@@ -14,7 +14,7 @@ export default {
default: undefined,
},
},
emits: ["update:modelValue", "selected-change"],
emits: ["update:modelValue", "selected-change", "change"],
setup(props: any, ctx: any) {
const options = ref<any[]>([]);
@@ -33,7 +33,8 @@ export default {
// if (props.modelValue == null && options.value.length > 0) {
// ctx.emit("update:modelValue", options.value[0].value);
// }
onSelectedChange(props.modelValue);
//这里需要一个第一次的selected-change事件,外部表单字段有情况会用到选中的option
onSelectedChange(props.modelValue, true);
}
onCreate();
@@ -41,9 +42,12 @@ export default {
ctx.emit("update:modelValue", value);
onSelectedChange(value);
}
function onSelectedChange(value: any) {
function onSelectedChange(value: any, isFirst: boolean = false) {
if (value) {
const option = options.value.find(item => item.value == value);
if (!isFirst) {
ctx.emit("change", value);
}
if (option) {
ctx.emit("selected-change", option);
return;
@@ -172,9 +172,9 @@ function useStepForm() {
const stepTypeSelected = (item: any) => {
if (item.needPlus && !settingStore.isPlus) {
message.warn("此插件需要开通专业版才能使用");
message.warn("此插件需要开通Certd专业版才能使用");
mitter.emit("openVipModal");
throw new Error("此插件需要开通专业版才能使用");
throw new Error("此插件需要开通Certd专业版才能使用");
}
currentStep.value.type = item.name;
currentStep.value.title = item.title;
@@ -160,9 +160,13 @@ export class CertApplyPlugin extends CertApplyBasePlugin {
onSelectedChange: ctx.compute(({form})=>{
return ($event)=>{
form.dnsProviderAccessType = $event.accessType
form.dnsProviderAccess = null
}
})
}),
onChange: ctx.compute(({form})=>{
return ($event)=>{
form.dnsProviderAccess = null
}
}),
},
}
`,