Add support for functional components
- Dominant language
- JavaScript
- Stars
- 162
- Forks
- 9
- PR merge metrics
- No merged PRs in 30d
Description
There might be a bit of trickery needed to make this happen, but currently a `.md` file like this:
```
# Example
import ExampleImport from '@/components/ExampleImport.vue';
export default {
functional: true,
components: {
ExampleImport,
},
};
```
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.
Contributor guide
No contributing guide indexed for this repository
Research direction
Start by reproducing the reported TypeError with the `.md` example and with a `.vue` file containing both `script` and `template` tags. Trace how markdown and Vue components are transformed, then verify that components declaring `functional: true` render without the `_vm` error and retain their imports and templates.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript
- Domain
- frontend, web-dev
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 38/100