ZhangQiPro/src/components/BaseButton.vue
sladro 29b58e6888 chore: ESLint代码规范修复 - 从779个问题降至13个警告
修复内容:
1.  ESLint配置完善
   - 添加浏览器全局变量:setTimeout, localStorage, getComputedStyle等
   - 禁用保留组件名规则 (vue/no-reserved-component-names)

2.  清理未使用的导入(自动修复648个警告)
   - BigScreenPortrait.vue: 移除reactive, mockPortraitData, generateChartData等
   - Evaluate.vue: 移除Search, Refresh, Download等未使用图标组件
   - Portrait.vue: 移除Download, Refresh组件
   - SubmissionDialog.vue: 移除Link组件
   - ReportCenter.vue: 移除onMounted导入

3.  修复未使用的变量
   - ReportAnalysis.vue: 移除未使用的index变量
   - FileUpload.vue: 移除未使用的index变量

修复结果:
- 修复前:779个问题(42错误,737警告)
- 修复后:13个问题(0错误,13警告)
- 修复率:98.3%

剩余13个警告:
- 未使用的error catch变量(4个)
- 未使用的index/role/student参数(7个)
- 未使用的导入DataAnalysis, getChartColors(2个)
- 所有警告不影响代码运行

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-10-01 17:29:59 +08:00

83 lines
1.4 KiB
Vue

<template>
<el-button
:type="type"
:size="size"
:loading="loading"
:disabled="disabled"
:icon="icon"
:class="['base-button', `btn-${variant}`]"
@click="handleClick"
>
<slot />
</el-button>
</template>
<script>
export default {
name: 'BaseButton',
props: {
type: {
type: String,
default: 'primary'
},
size: {
type: String,
default: 'default'
},
variant: {
type: String,
default: 'default',
validator: (value) => ['default', 'gradient', 'outline'].includes(value)
},
loading: {
type: Boolean,
default: false
},
disabled: {
type: Boolean,
default: false
},
icon: {
type: String,
default: ''
}
},
emits: ['click'],
methods: {
handleClick(event) {
if (!this.loading && !this.disabled) {
this.$emit('click', event)
}
}
}
}
</script>
<style scoped>
.base-button {
transition: var(--transition);
border-radius: var(--radius-md);
}
.btn-gradient {
background: var(--gradient-primary);
border: none;
color: var(--text-inverse);
}
.btn-gradient:hover {
opacity: 0.9;
transform: translateY(-1px);
}
.btn-outline {
background: transparent;
border: 2px solid var(--primary);
color: var(--primary);
}
.btn-outline:hover {
background: var(--primary);
color: var(--text-inverse);
}
</style>