fix: Fixed issue with edit runtime port failed (#11096)

Refs https://github.com/1Panel-dev/1Panel/issues/11091
This commit is contained in:
CityFun 2025-11-27 11:51:24 +08:00 committed by GitHub
parent e32a11910e
commit 42f61f60fb
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -13,7 +13,11 @@
</el-col>
<el-col :span="7">
<el-text>{{ $t('app.allowPort') }}</el-text>
<el-switch class="ml-1" v-model="port.hostIP" :active-value="''" :inactive-value="'127.0.0.1'" />
<el-switch
class="ml-1"
:model-value="port.hostIP === ''"
@update:model-value="handleSwitchChange($event, index)"
/>
</el-col>
<el-col :span="2">
<el-form-item>
@ -47,6 +51,10 @@ const rules = reactive<FormRules>({
port: [Rules.requiredInput, Rules.paramPort, checkNumberRange(1, 65535)],
});
const handleSwitchChange = (value: boolean, index: number) => {
props.exposedPorts[index].hostIP = value ? '' : '127.0.0.1';
};
const addPort = () => {
props.exposedPorts.push({
hostPort: undefined,