Vue CLI:The template root requires exactly one element
最近更新时间 2020-03-11 21:55:57
在 Vue CLI 开发中,新建模板文件如下所示:
<template>
</template>
<script>
export default {
name: 'T'
}
</script>
<style scoped>
</style>
后会出现如下错误信息:
ERROR Failed to compile with 1 errors 12:53:34 PM
error in ./src/views/test/Query.vue
Module Error (from ./node_modules/eslint-loader/index.js):
/src/views/test/Query.vue
1:1 error The template root requires exactly one element vue/valid-template-root
✖ 1 problem (1 error, 0 warnings)
@ ./src/routes/inner.js 25:9-35
@ ./src/routes/index.js
@ ./src/plugins/router.js
@ ./src/main.js
@ multi (webpack)-dev-server/client?http://127.0.0.1:8080/sockjs-node (webpack)/hot/dev-server.js ./src/main.js
解决办法,需在 <template> 下添加一个任意元素。