[FEAT Contribution] Plugin Support for vue V-Model integration and event interoperability #1266
Open
1 of 11 tasks
Labels
enhancement
New feature or request
I am interested in helping provide a feature!
Yes
Which generators are impacted?
What problem does this feature solve?
As discussed on #833 and following the investigation and api proposal of @bjufre, ive created a custom plugin for mitosis that does many things to solve event interoperability and prop drilling for vue outputs.
The plugin does 3 main things:
defineEmits
automatically for the component, so we follow the vue guidelines as stated heredefineProps()
like the guidelines of vue suggest instead of the default exportprops
array property that misses the usage of the already bundledProps
interface (can be any interface as mitosis handles it using jsonpropsTypeRef
property) (Also can work as standalone plugin to improve props of components without v-mode /emit concerns)Limitations:
What does the proposed API look like?
I've used in the same project as stated on #1265 to bundle playground testing and the plugin itself so the code of the plugin can be found here.
The
mitosis.config.js
will look something like this:The code of the component (I've used the example of the #833 SuperInput jsut for validation ease) can look like this:
and will generate an output like this:
solving almost entirely the event interoperability
Additional Information
The plugin is pretty basic and may not fulfill 100% of the desired interoperability but can help for the initial structure and maybe the vue improvement from mitosis compiler and the mos common v-model scenarios without destroying the mitosis philosophy of "write once and bundle many"
Any feedback or review is appreciated. This is my first big open source contribution, so I'm open to all suggestions
The text was updated successfully, but these errors were encountered: