修复图表实例标识并扩展版本兼容性
All checks were successful
Package component / package (push) Successful in 6m0s

This commit is contained in:
李启源
2026-07-21 16:37:35 +08:00
parent 65a0c4933c
commit 07e9855eac
9 changed files with 448 additions and 9 deletions

10
src/utils/waveformId.ts Normal file
View File

@@ -0,0 +1,10 @@
import { getCurrentInstance } from 'vue'
let fallbackId = 0
/** Generate an instance-scoped id without requiring Vue 3.5's useId API. */
export function useWaveformInstanceId(prefix = 'waveform') {
const instance = getCurrentInstance()
const instanceId = instance ? `v${instance.uid}` : `f${++fallbackId}`
return `${prefix}-${instanceId}`
}