erb-loader出现问题,无法使用.vue.erb文件

时间:2017-06-13 21:19:35

标签: ruby-on-rails ruby vue.js erb webpacker

我正在使用vue,一切都很顺利,但是目前用erb编译,控制台显示错误:

ERROR in ./app/javascript/packs/onboarding/HomeForm.vue.erb
Module parse failed: /Users/yorch/SitesRails/homie/node_modules/rails-erb-
loader/index.js??ref--3!/Users/yorch/SitesRails/homie/app/javascript/packs/onboarding/HomeForm.vue.erb 
Unexpected token (1:0)
You may need an appropriate loader to handle this file type.
<template>
<div>
<form action="/" style="margin-top: 50px;" @submit.prevent="login">
error Command failed with exit code 2.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this 
command.
请,希望可以帮助我!

感谢

<template>
<div>
       <form action="/" style="margin-top: 50px;" @submit.prevent="login">
        <div class="form-group">
            <label for="name">Name</label>
            <input type="text" class="form-control" id="name" v model="home.name">
        </div>
        <div class="form-group">
            <input type="submit" class="btn btn-primary" value="Login">
        </div>

        <label>{{greeting}}</label>
    </form>

</div>
</template>

<script>
   export default {
    props: [
        'user'
    ],
    data() {
        return {
            home: {
                name: ''
            },
        }
    },
    computed: {
        greeting() {
            return `${this.home.name} ${this.user}`
        }
    },
    methods: {
        login() {
            alert('login');
        }
    }
}
</script>

这是文件的内容。 目前只有html和js,但是erb扩展编译y不能正常工作

0 个答案:

没有答案