[Vue warn]: Failed to mount component: template or render function not defined. (How to Solve)

Solution
import Vue from “vue”; The default imported file is vue/dist/vue.runtime.common.js. This can be found in the node_modules/vue/package.json file. The main option of the package file specifies the file to be executed by default. The key package.json code is as follows:

This code shows that the vue.runtime.common.js file does not contain a compiler, so the template option is not supported. If we use the Webpack and template options, we can use the vue.common.js file. The vue.common.js file contains the compiler. So put in main.js

change into:

In this way, the vue file can be used normally

 

Similar Posts: