[Vuejs]-How to avoid [Vue warn]: Injection "xxxx" not found

7👍

To avoid the warning, specify a default value (the 2nd argument to inject()):

const test = inject<Function>('test', () => {})

demo

👤tony19

Leave a comment