[Vue warn]: You are using the runtime-only build of Vue where the templa

 [Vue warn]: 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.(found in )


上述报错是发生在使用vue框架时,单纯的向Vue中绑定一个template,如下:

	
new Vue({
        el: '#app',
        template:"<div>wret</div>"
       // router,
       // render: h => h(App)
})

下面看大神的解答:

****************************************************************************************************************************************************************************

图片描述

这是什么意思呢?
运行时构建不包含模板编译器,因此不支持 template 选项,只能用 render 选项,但即使使用运行时构建,在单文件组件中也依然可以写模板,因为单文件组件的模板会在构建时预编译为 render 函数。
上面一段是官方api中的解释。就是说,如果我们想使用template,我们不能直接在客户端使用npm install之后的vue。此时,再去看查vue模块,添加几行
resolve: {
alias: {
'vue': 'vue/dist/vue.js'
}
}
再运行,没错ok了。


作者: 外号理论汪 
链接:http://www.imooc.com/article/17868
来源:慕课网
本文原创发布于慕课网 ,转载请注明出处,谢谢合作!
  • 3
    点赞
  • 6
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值