fix: 🐛 eslint 打包警告问题修复

This commit is contained in:
超凡
2025-04-20 17:26:08 +08:00
parent d543aac63e
commit bf16ca5963
3 changed files with 28 additions and 31 deletions

View File

@@ -5,21 +5,15 @@
<el-col v-show="!item.hidden" v-bind="item.col">
<el-form-item :label="item.label" :prop="item.prop">
<!-- Label -->
<template v-if="item.tips" #label>
<span>
{{ item.label }}
<el-tooltip
placement="bottom"
effect="light"
:content="item.tips"
:raw-content="true"
>
<el-icon style="vertical-align: -0.15em" size="16">
<QuestionFilled />
</el-icon>
<template #label>
<span class="flex-y-center">
{{ item?.label || "" }}
<el-tooltip v-if="item?.tips" v-bind="getTooltipProps(item.tips)">
<QuestionFilled class="w-4 h-4 mx-1" />
</el-tooltip>
</span>
</template>
<!-- Input 输入框 -->
<template v-if="item.type === 'input' || item.type === undefined">
<el-input v-model="formData[item.prop]" v-bind="item.attrs" />
@@ -151,6 +145,11 @@ function setFormItemData(key: string, value: any) {
formData[key] = value;
}
// 获取tooltip提示框属性
const getTooltipProps = (tips: string | IObject) => {
return typeof tips === "string" ? { content: tips } : tips;
};
// 暴露的属性和方法
defineExpose({ formRef, getFormData, setFormData, setFormItemData });
</script>

View File

@@ -12,12 +12,7 @@
<template #label>
<span class="flex-y-center">
{{ item?.label || "" }}
<el-tooltip
v-if="item?.tips"
v-bind="
typeof item.tips === 'string' ? { content: item.tips } : (item.tips as any)
"
>
<el-tooltip v-if="item?.tips" v-bind="getTooltipProps(item.tips)">
<QuestionFilled class="w-4 h-4 mx-1" />
</el-tooltip>
<span v-if="searchConfig.colon" class="ml-0.5">:</span>
@@ -92,7 +87,10 @@ const componentMap = new Map<ISearchComponent, Component>([
/* eslint-enable */
]);
// 存储表单实例
const queryFormRef = ref<FormInstance>();
// 存储查询参数
const queryParams = reactive<IObject>({});
// 是否显示
const visible = ref(true);
// 响应式的formItems
@@ -119,12 +117,21 @@ const isGrid = computed(() =>
? "grid grid-cols-1 md:grid-cols-2 xl:grid-cols-3 2xl:grid-cols-4 3xl:grid-cols-5 4xl:grid-cols-6 gap-5"
: "flex flex-wrap gap-x-8 gap-y-4"
);
// 搜索表单数据
const queryParams = reactive<IObject>({});
// 获取tooltip提示框属性
const getTooltipProps = (tips: string | IObject) => {
return typeof tips === "string" ? { content: tips } : tips;
};
// 查询/重置操作
const handleQuery = () => emit("queryClick", queryParams);
const handleReset = () => {
queryFormRef.value?.resetFields();
emit("resetClick", queryParams);
};
onMounted(() => {
formItems.forEach((item) => {
item.initFn && item.initFn(item);
item?.initFn && item.initFn(item);
if (["input-tag", "custom-tag", "cascader"].includes(item?.type ?? "")) {
queryParams[item.prop] = Array.isArray(item.initialValue) ? item.initialValue : [];
} else if (item.type === "input-number") {
@@ -134,14 +141,6 @@ onMounted(() => {
}
});
});
// 查询/重置操作
const handleQuery = () => emit("queryClick", queryParams);
const handleReset = () => {
queryFormRef.value?.resetFields();
emit("resetClick", queryParams);
};
// 暴露的属性和方法
defineExpose({
// 获取分页数据

View File

@@ -1,6 +1,5 @@
import type { DialogProps, DrawerProps, FormItemRule, PaginationProps } from "element-plus";
import type { FormProps, TableProps, ColProps, ButtonProps, CardProps } from "element-plus";
import type { ElTooltipProps } from "element-plus";
import type PageContent from "./PageContent.vue";
import type PageForm from "./PageForm.vue";
import type PageModal from "./PageModal.vue";
@@ -53,7 +52,7 @@ export interface ISearchConfig {
// 标签文本
label?: string;
// 标签提示
tips?: string | Partial<ElTooltipProps>;
tips?: string | IObject;
// 键名
prop: string;
// 组件属性(input-tag组件支持join,btnText,size属性)