修复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', type: 'pie',
radius: ['40%', '70%'], radius: ['40%', '70%'],
// avoidLabelOverlap: false, // avoidLabelOverlap: false,
top: '20%', top: '20%',
itemStyle: { itemStyle: {
borderRadius: 10 borderRadius: 10
@@ -70,6 +71,8 @@ const initChart = () => {
position: 'center' position: 'center'
}, },
emphasis: { emphasis: {
scale: true,
scaleSize: 5,
itemStyle: { itemStyle: {
shadowBlur: 10, shadowBlur: 10,
shadowOffsetX: 0, shadowOffsetX: 0,
@@ -79,9 +82,9 @@ const initChart = () => {
labelLine: { labelLine: {
show: true show: true
}, },
hoverOffset: 15, // 增加悬停偏移量 // hoverOffset: 15, // 增加悬停偏移量
still: false, // 允许悬浮动画 still: false, // 允许悬浮动画
silent: true, // 启用交互 cursor: 'pointer',
// 添加响应阈值配置 // 添加响应阈值配置
hoverAnimationThreshold: 1, // 无论多小的区块都可交互 hoverAnimationThreshold: 1, // 无论多小的区块都可交互
selectedOffset: 10, // 选中项偏移量 selectedOffset: 10, // 选中项偏移量
@@ -94,7 +97,8 @@ const initChart = () => {
onMounted(() => { onMounted(() => {
// 延迟初始化确保DOM就绪 // 延迟初始化确保DOM就绪
setTimeout(initChart, 0) setTimeout(initChart, 0)
window.addEventListener('resize', initChart) // window.addEventListener('resize', initChart)
window.addEventListener('resize', initChart);
}) })
onUnmounted(() => { onUnmounted(() => {
@@ -103,6 +107,7 @@ onUnmounted(() => {
chartInstance = null chartInstance = null
} }
window.removeEventListener('resize', initChart) window.removeEventListener('resize', initChart)
}) })
// 数据变化时更新 // 数据变化时更新
@@ -120,9 +125,13 @@ watch(() => props.data, () => {
<style scoped> <style scoped>
.chart-container { .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> </style>