在线观看不卡亚洲电影_亚洲妓女99综合网_91青青青亚洲娱乐在线观看_日韩无码高清综合久久

鍍金池/ 問答/HTML/ Vue2.0報(bào)錯(cuò)Failed to mount component: templ

Vue2.0報(bào)錯(cuò)Failed to mount component: template....

vue-cli構(gòu)建項(xiàng)目,vue版本2.0+
組件player應(yīng)用在App.vue里面,一直報(bào)錯(cuò)

clipboard.png

谷歌+百度之后,大概是知道Vue2.0+以后默認(rèn)不采用template渲染DOM了,需要在webpack.config.js里面修改

 'vue'  : 'vue/dist/vue.min',

疑問如下:
1)既然2.0以上版本不再采用tempalte渲染dom,為什么我們每次在寫.vue文件的時(shí)候,還是按照

<template></template>
<script></script>
<style></style>  

這樣寫
2)我那樣修改之后('vue' : 'vue/dist/vue.min',)是不報(bào)錯(cuò)的,但是DOM并沒有渲染
求問解決方式-----QAQ-------

回答
編輯回答
傻叼

The reason you're receiving that error is that you're using the runtime build which doesn't support templates in HTML files as seen here vuejs.org

In essence what happens with vue loaded files is that their templates are compile time converted into render functions where as your base function was trying to compile from your html element.

2018年1月3日 23:33
編輯回答
陌南塵

你只用了運(yùn)行時(shí)的vue腳本,需要vue-loader來處理vue文件

2017年7月21日 12:18