今天在使用vue框架搭建環境時,遇到這個錯誤提示:
[Vue warn]: Attribute "id" is ignored on component <div> because the component is a fragment instanc
這個提示的原因是使用 vue-router 和 vue-loader 插件的時候在最外面那個 template 里面,所有內容的外面沒有使用一個div包起來。
如果沒有使用div或者其他的元素包起來,vue-router 跳轉時,vue不知道要刪除哪些東西,所以才會報錯。