Update JPopup.vue

修改清空方式,防止在禁用的时候仍可清空
This commit is contained in:
huoshicang 2025-07-18 15:11:28 +08:00 committed by GitHub
parent c30e35c42d
commit 277b5c43ac
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 16 additions and 19 deletions

View File

@ -2,15 +2,10 @@
<template> <template>
<div class="JPopup components-input-demo-presuffix" v-if="avalid"> <div class="JPopup components-input-demo-presuffix" v-if="avalid">
<!--输入框--> <!--输入框-->
<a-input @click="handleOpen" :value="innerShowText || showText" :placeholder="placeholder" v-bind="attrs"> <a-input @click="handleOpen" v-model:value="showText" :placeholder="placeholder" v-bind="attrs" allow-clear @change="handleEmpty">
<template #prefix> <template #prefix>
<Icon icon="ant-design:cluster-outlined"></Icon> <Icon icon="ant-design:cluster-outlined"></Icon>
</template> </template>
<!-- update-begin-author:taoyan date:2022-5-31 for: VUEN-1157 popup 选中后有两个清除图标后边这个清除只是把输入框中数据清除实际值并没有清除 -->
<template #suffix>
<Icon icon="ant-design:close-circle-outlined" @click="handleEmpty" title="清空" v-if="showText"></Icon>
</template>
<!-- update-begin-author:taoyan date:2022-5-31 for: VUEN-1157 popup 选中后有两个清除图标后边这个清除只是把输入框中数据清除实际值并没有清除 -->
</a-input> </a-input>
<!-- update-begin--author:liaozhiyang---date:20240515---forQQYUN-9260必填模式下会影响到弹窗内antd组件的样式 --> <!-- update-begin--author:liaozhiyang---date:20240515---forQQYUN-9260必填模式下会影响到弹窗内antd组件的样式 -->
<a-form-item> <a-form-item>
@ -116,22 +111,24 @@
/** /**
* TODO 清空 * TODO 清空
*/ */
function handleEmpty() { function handleEmpty(e) {
// showText.value = ''; // showText.value = '';
// update-begin--author:huoshicang---date:20250716 // update-begin--author:huoshicang---date:20250716
// popup if (!e.target.value) {
let { fieldConfig } = props; // popup
// let { fieldConfig } = props;
let values = {}; //
for (let item of fieldConfig) { let values = {};
item.target.split(',').forEach((target) => { for (let item of fieldConfig) {
// item.target.split(',').forEach((target) => {
values[target] = ''; //
}); values[target] = '';
});
}
props.formElRef && props.formElRef.setFieldsValue(values);
props.setFieldsValue && props.setFieldsValue(values);
emit('popUpChange', values);
} }
props.formElRef && props.formElRef.setFieldsValue(values);
props.setFieldsValue && props.setFieldsValue(values);
emit('popUpChange', values);
// update-end--author:huoshicang---date:20250716 // update-end--author:huoshicang---date:20250716
} }