egoist / vmark

Convert markdown to Vue component.
MIT License
162 stars 11 forks source link

Add support for functional components #12

Open b12f opened 5 years ago

b12f commented 5 years ago

There might be a bit of trickery needed to make this happen, but currently a .md file like this:

# Example
<example-import></example-import>

<script>
import ExampleImport from '@/components/ExampleImport.vue';

export default {
    functional: true,
    components: {
        ExampleImport,
    },
};
</script>

Will throw [Vue warn]: Error in render: "TypeError: _vm is undefined". This also happens when in .vue files, you define both a script and a template tag, instead of either/or. Would it be possible to see if someone has set functional: true on their component and inlining the template if so? This could provide quite a significant speed-up in rendering stateless components.