【发布时间】:2017-12-13 12:10:09
【问题描述】:
我不知道错误是什么,目前我正在通过控制台日志进行测试,以检查选择文件(用于上传)后的更改。
当我运行$ npm run watch 时,我收到以下错误:
“Webpack 正在查看文件……
95% 排放
ERROR 编译失败,出现 1 个错误
19:42:29./resources/assets/js/components/File.vue 中的错误
(发出的值而不是错误的实例)Vue 模板语法 错误:
组件模板应该只包含一个根元素。如果你 在多个元素上使用 v-if,使用 v-else-if 链接它们 而是。
@ ./resources/assets/js/components/AvatarUpload.vue 5:2-181 @ ./resources/assets/js/app.js @多./resources/assets/js/app.js ./resources/assets/sass/app.scss"
我的 File.vue 是
<template>
<div class="form-group">
<label for="avatar" class="control-label">Avatar</label>
<input type="file" v-on:change="fileChange" id="avatar">
<div class="help-block">
Help block here updated 4 ???? ...
</div>
</div>
<div class="col-md-6">
<input type="hidden" name="avatar_id">
<img class="avatar" title="Current avatar">
</div>
</template>
<script>
export default{
methods: {
fileChange(){
console.log('Test of file input change')
}
}
}
</script>
关于如何解决这个问题的任何想法?究竟是什么错误?
【问题讨论】:
-
如果您的 拼写错误,您也会收到此错误。发生在我的一个朋友身上...
标签: javascript node.js laravel vue.js