-
Notifications
You must be signed in to change notification settings - Fork 344
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
the components
option in createComponent() doesn't support vue2 options
#62
Comments
import {createComponent, createElement as h } from 'vue-function-api';
import HelloWorld from './components/HelloWorld.vue';
export default createComponent({
setup() {
return () => h(HelloWorld)
}
}); You can make it work by a force-cast as well. import {createComponent, createElement as h } from 'vue-function-api';
import HelloWorld from './components/HelloWorld.vue';
export default createComponent({
components: {HelloWorld}
} as any); |
components
option in setup() is not working as expectcomponents
option in createComponent() is not working as expect
OK, thank you. I have another question, could I use it along with template? Using render function will override the template. |
@HermitSun Yes. You can use it with the template, but it still requests a force-cast for passing |
I got your point. Thanks a lot. |
the export default createComponent({
name: 'componentName'
}) |
I think you should not cast the options obect to |
Maybe we can expand the interface? Just like @PatrykWalach said in issue#63: import {ComponentOptions} from 'vue-function-api/dist/ts-api/component';
import {AsyncComponent, Component} from 'vue';
declare module 'vue-function-api/dist/ts-api/component' {
interface ComponentOptions {
components?: {
[key: string]: Component<any, any, any, any> | AsyncComponent<any, any, any, any>
};
}
} |
Casting export default {
components: {
},
...createComponent({
setup(props) {
},
props: {
}
})
} |
Why so? By spec, its not written anywhere that |
You are welcome to work on solving this challebge. |
Before trying tackle the problem, I need to understand it in its entirety. |
The properties probably has been removed unintentionally, the options inside |
I thought this is a better solution. Yet I still wanna see types contain components option originally. So why are you removing it actually? |
I'm confused. Is the final behavior going to no longer allow |
@jorgy343 It will allow all vue2 options. |
This is already been fixed in dev branch. |
While the issue is not fixed, I believe that best way to work it around is by temporarily replacing It should be fairly quick to rollback to using |
@liximomo Seems that on |
@kevinmarrec I couldn't reproduce it. Can you provide an online example? |
Can you release a version as soon as possible? 2.2.1 for |
@bigmeow The package has been rename to @vue/composition-api. |
This already got fixed in the new package |
components
option in createComponent() is not working as expectcomponents
option in createComponent() is not support vue2 options
components
option in createComponent() is not support vue2 optionscomponents
option in createComponent() don't supports vue2 options
components
option in createComponent() don't supports vue2 optionscomponents
option in createComponent() doesn't support vue2 options
@liximomo About #62 (comment), I opened #81 with reproduction |
After I updated to 2.2.0, I found that when I run
npm run serve
, the develop server console ouput is just like this:And I cannot run
npm run build
, the process will crash because of the error.However, the browser console didn't show any errors, and it can run normally. So I cannot simply reproduce it online... In fact, I just create the project with vue-cli3, and change
App.vue
to this:I read the RFC again, and maybe 3.x will continue to be compatible with the 2.x components option?
And when I went back to 2.1.2, the type error disappeared. Did I go something wrong? Or how can I import and use
*.vue
components correctly?The text was updated successfully, but these errors were encountered: