Skip to content
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

我的dependencies中某个依赖包需要在注册的时候传入参数,我该如何设置或者使用才能正确的传入参数呢? #4354

Open
4 tasks done
wdbsrl opened this issue Nov 12, 2024 · 1 comment

Comments

@wdbsrl
Copy link

wdbsrl commented Nov 12, 2024

Is your feature request related to a problem? Please describe.

我的某个包在使用时,需要传入一些常量参数,类似这样

app.use(myPackage, {
param1: xxxxx,
params22: xxxx,
});

Describe the solution you'd like

可以传参即可

Describe alternatives you've considered

No response

Additional context

No response

Validations

@florian-sattler
Copy link
Contributor

I apologize if I've misunderstood your issue, as I had to auto-translate your problem to English.

Vitepress uses on the default component registration from Vue, which is documented here: https://vuejs.org/guide/components/registration

To achieve your goal, you can utilize the enhanceApp method from the theme interface within your .vitepress/theme/index.ts file which exposes the raw vue app object, as described in the Vitepress documentation:
https://vitepress.dev/guide/custom-theme#theme-interface

For additional information, please refer to the Vue documentation on application instance methods: https://vuejs.org/api/application#app-use

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants