This content originally appeared on CodeSource.io and was authored by Deven
If you are getting failed to mount component: template or render function not defined error. This article will help you to fix the issue.
The most common Solution is that It should be
require('./components/Example.vue').default.
Since v13, vue-loader exports the component as the default key, which still works the same when using import, but requires the above when using require.
Consider the example below:
let routes = [{
path: '/contact',
component: require('./components/Contact.vue').default
},
{
path: '/about',
component: require('./components/About.vue').default
}
]
Above we haver added .default
to our component requires.
The post fix vue failed to mount component: template or render function not defined. appeared first on CodeSource.io.
This content originally appeared on CodeSource.io and was authored by Deven
Deven | Sciencx (2021-02-23T17:21:36+00:00) fix vue failed to mount component: template or render function not defined.. Retrieved from https://www.scien.cx/2021/02/23/fix-vue-failed-to-mount-component-template-or-render-function-not-defined/
Please log in to upload a file.
There are no updates yet.
Click the Upload button above to add an update.