-
-
Notifications
You must be signed in to change notification settings - Fork 8.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Feature Request] Access to global configuration in setup context #1074
Comments
|
@yyx990803 Seems unable to inject css module $style, has any alternative method? |
@johnsoncodehk you have |
@posva I have been troubled by this problem for a long time! I always to use |
有没有什么方式能过改善这种写法? import { defineComponent, getCurrentInstance } from 'vue';
export default defineComponent({
setup() {
const { proxy } = getCurrentInstance(); // 这样写会报告 proxy会错误,只能一步步写成如下方式
const that = getCurrentInstance();
const mitt = that?.proxy?.$mitt;
return () => (
<div
class='test'
onClick={() => {
mitt?.emit('vite-tabspage-add', { a: 1 });
}}
>
emit
</div>
);
},
}); |
What problem does this feature solve?
We may need to access global configured properties in
setup()
. As there is nothis
in the setup it would be great to access global configured properties from theSetupContext
.What does the proposed API look like?
Please have a look at the simple example below just to give an idea about the usage.
The text was updated successfully, but these errors were encountered: