vue引入插件后页面不生效

309 阅读1分钟

在引入vue-circle-progress插件时,遇到了如下报错

You are using the runtime-only build of Vue where the template compiler is not available. Either pre-compile the templates into render functions, or use the compiler-included build. 搜索该问题得知,这是由于在项目配置的时候,默认 npm 包导出的是运行时构建,即 runtime 版本,不支持编译 template 模板。

解决方法: 修改配置文件中的 vue 引用

我是用的vuecli3版本,在vue.config.js中添加一句话

module.exports = {
  runtimeCompiler: true,
}

这样就可以支持template编译。