Closed kpturner closed 2 years ago
Solution: https://github.com/vuejs/vue-class-component/issues/602#issuecomment-1075345146
The base clase should be a .ts and not a .vue file.
It cannot be a .ts
file if it contains an HTML template and some CSS. That is the problem. This is a base vue component and when you extend it (in Vue 2 at least) those that extend it inherit the template and styling.
I guess I will just have to refactor the code to split out the script
It does not seem to work well for me. If every component
extends Vue
the it is OK, but if you have a project (like an old Vue 2 project that you are migrating) whereComponent A
is extended byComponent B
the it fails at run time withUncaught TypeError: Class extends value #<Object> is not a constructor or null
It is easy to reproduce. I just created a simple Vue 3 app using Vite. Add a component like this
Then create another component that extends it
Then use
ClassComponent
in your app somewhere. It will fail with the error defined above.