【发布时间】:2016-09-27 19:09:42
【问题描述】:
我打算使用webpack 将Vue 演示组件构建到我的项目中,但出现以下错误,请告诉我发生了什么?
ERROR in ./~/babel-loader?presets[]=es2015&plugins[]=transform-runtime&comments=false!./~/vue-loader/lib/selector.js?type=script&index=0!./src/components/pms/dashboard.vue
Module build failed: SyntaxError: D:/WorkSpace/YongTai/src/components/pms/dashboard.vue: Unexpected token (2:0)
< th v-for="key in columns"
at Parser.pp.raise (D:\WorkSpace\YongTai\node_modules\babylon\lib\parser\location.js:22:13)
at Parser.pp.unexpected (D:\WorkSpace\YongTai\node_modules\babylon\lib\parser\util.js:89:8)
我的vue 代码包括以下代码行:
script type="text/x-template" id="grid-template">
< table>< t head> < tr>< t h v-for="key in columns"
【问题讨论】:
-
删除
< table、< t h等内部的空格 -
我的代码中没有空格,为了在stackoverflow中显示代码,我不得不添加一些空格。
-
它刚刚击中了我!您应该在 vue 文件中使用
<template>标签而不是<script type= ...。