修复bug

This commit is contained in:
梁泽军
2025-03-21 18:01:11 +08:00
parent 538de6d717
commit 20f1b260d7

View File

@@ -61,6 +61,7 @@ const initChart = () => {
type: 'pie',
radius: ['40%', '70%'],
// avoidLabelOverlap: false,
top: '20%',
itemStyle: {
borderRadius: 10
@@ -70,6 +71,8 @@ const initChart = () => {
position: 'center'
},
emphasis: {
scale: true,
scaleSize: 5,
itemStyle: {
shadowBlur: 10,
shadowOffsetX: 0,
@@ -79,9 +82,9 @@ const initChart = () => {
labelLine: {
show: true
},
hoverOffset: 15, // 增加悬停偏移量
// hoverOffset: 15, // 增加悬停偏移量
still: false, // 允许悬浮动画
silent: true, // 启用交互
cursor: 'pointer',
// 添加响应阈值配置
hoverAnimationThreshold: 1, // 无论多小的区块都可交互
selectedOffset: 10, // 选中项偏移量
@@ -94,7 +97,8 @@ const initChart = () => {
onMounted(() => {
// 延迟初始化确保DOM就绪
setTimeout(initChart, 0)
window.addEventListener('resize', initChart)
// window.addEventListener('resize', initChart)
window.addEventListener('resize', initChart);
})
onUnmounted(() => {
@@ -103,6 +107,7 @@ onUnmounted(() => {
chartInstance = null
}
window.removeEventListener('resize', initChart)
})
// 数据变化时更新
@@ -120,9 +125,13 @@ watch(() => props.data, () => {
<style scoped>
.chart-container {
touch-action: manipulation;
/* touch-action: manipulation; */
/* 优化移动端触控 */
-webkit-tap-highlight-color: transparent;
/* -webkit-tap-highlight-color: transparent; */
/* 移除点击高光 */
-webkit-user-select: none;
user-select: none;
/* 优化点击反馈 */
transition: filter 0.2s;
}
</style>