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

Allow passing more options to VueComponentWith() #134

Open
steffans opened this issue May 5, 2021 · 5 comments
Open

Allow passing more options to VueComponentWith() #134

steffans opened this issue May 5, 2021 · 5 comments

Comments

@steffans
Copy link

steffans commented May 5, 2021

It would be nice to allow other Vue Component options then components when using Vue syntax in .md file. For example props can be useful as well. There could be a second function parameter called options, like so: VueComponentWith(components, options)

import { VueComponentWith } from '../contents/test.md';

const TestComponent = VueComponentWith({ ... }, {
   props: ['prop1', ...]
});
@hmsk
Copy link
Owner

hmsk commented May 8, 2021

Interesting. Could you share your real world use-cases which the feature helps/solves?

@steffans
Copy link
Author

steffans commented May 9, 2021

Actually i would use it with ˋpropsˋ which i needed on the components i also passed to the markdown markup. Could be also useful to pass props with additional data like done in Vuepress. See: https://vuepress.vuejs.org/guide/using-vue.html#templating

@hmsk
Copy link
Owner

hmsk commented May 9, 2021

Got it. I was interested in what you try to make actually in the "real world". What you're building, what the feature you suggested solves 😉

See: https://vuepress.vuejs.org/guide/using-vue.html#templating

I'm not so keen on supporting templating features like VuePress basically and would recommend using MDX for more dynamic handling.

@steffans
Copy link
Author

steffans commented May 9, 2021

The 'templating' hash of the doc was not precise, i use it to pass props which i can use on the passed components. Like this:

# Headline

<my-component :some-prop="myProp"/>

Other text ....

@hmsk
Copy link
Owner

hmsk commented May 9, 2021

so actually what makes happen by <my-component :some-prop="myProp"/> ?

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