vbenjs / vue-vben-admin

A modern vue admin panel built with Vue3, Shadcn UI, Vite, TypeScript, and Monorepo. It's fast!
https://www.vben.pro
MIT License
24.45k stars 6.67k forks source link

useContext hook优化建议 #3803

Closed chenxiaofie closed 3 months ago

chenxiaofie commented 5 months ago

Subject of the feature

Problem

我在尝试把Basic form这些组件抽离出来组成一个组件库的时候碰到了一个警告 inject() can only be used inside setup() or functional components. 然后我根据控制台提供的调用堆栈 发现了警告在useContext.ts这个hook当中 这个问题在开发环境的时候不会出现 打包后就出现了

Expected behaviour

What should happen? Please describe the desired behaviour.

Alternatives

是否可以使用Map来替代Vue3的provide和inject?

anncwb commented 3 months ago

This issue is stale because it has been open 60 days with no activity. Remove stale label or comment or this will be closed in 7 days