在做gulp watch时我得到了意想不到的令牌

时间:2017-03-18 09:59:12

标签: vue.js

这是我的app.js文件

import Vue from 'vue';  
import Posts from './Components/Posts.vue';


new Vue({
    el : '.container',
    data : {

    },
    components : { Posts }
})

Posts.vue

<script type="text/javascript">
export default {
    data : (){
        return{
            msg : 'Hello'
        }
    }
}
</script>
<template>
    <div class="container">
        <h1>{{msg}}</h1>
        <ul class="collection">
            <li class="collection-item avatar">
                <img src="images/yuna.jpg" alt="" class="circle">
                <span class="title">Title</span>
                <p>First Line <br>
                    Second Line
                </p>
                <a href="#!" class="secondary-content"><i class="material-icons">grade</i></a>
            </li>
            <li class="collection-item avatar">
                <i class="material-icons circle">folder</i>
                <span class="title">Title</span>
                <p>First Line <br>
                    Second Line
                </p>
                <a href="#!" class="secondary-content"><i class="material-icons">grade</i></a>
            </li>
            <li class="collection-item avatar">
                <i class="material-icons circle green">insert_chart</i>
                <span class="title">Title</span>
                <p>First Line <br>
                    Second Line
                </p>
                <a href="#!" class="secondary-content"><i class="material-icons">grade</i></a>
            </li>
            <li class="collection-item avatar">
                <i class="material-icons circle red">play_arrow</i>
                <span class="title">Title</span>
                <p>First Line <br>
                    Second Line
                </p>
                <a href="#!" class="secondary-content"><i class="material-icons">grade</i></a>
            </li>
        </ul>
    </div>
</template>
<style>

</style>

但我得到Parse错误:Browserify失败了意外的令牌。在我的Posts.vue附近我的脚本。我真的很困惑。什么是错误?如果我删除我的类型=“text / javascript”相同。这有什么问题我只是试着显示我的数据。抱歉英文不好

1 个答案:

答案 0 :(得分:0)

这意味着Posts.vue中存在语法错误。删除data : (){

中的冒号
data () {
    return{
        msg : 'Hello'
    }
}