This commit is contained in:
10
src/utils/waveformId.ts
Normal file
10
src/utils/waveformId.ts
Normal 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}`
|
||||
}
|
||||
Reference in New Issue
Block a user