VueJS:未捕获的SyntaxError:意外的令牌导入

时间:2017-08-03 23:33:57

标签: vue.js

感谢您阅读此内容。我正在使用vuejs和flask作为服务器构建一个Web应用程序。你们有什么建议为什么它不承认" import"?我试图使用这个。$ http.get。为什么不承认呢?提前谢谢

import Vue from 'vue'
import VueResource from 'vue-resource'

Vue.component( 'button-labels', {

    props : ['labelbtn'],
    template :   `<div class="button-container"><button class="button-app" v-for="label in labelbtn"  v-on:click="clickHandler(label)" >{{label.label}}</button></div>`,
    methods : {

        clickHandler : function(label) {

            if (label.id === 1)
            {
                this.$emit('event_child', 'search-template')

            }
        },


  }


})

Vue.component( 'search-template', {

    props: ['searchdata'],
    data : {
        entries : []

    },
    template :   `<div><input class="searchBar"><div class="response-list"><button class="entries"></button></div>
                    <audio class="audio" controls></audio><button class="button-back" v-on:click="backHandler"> Return</button></div>` ,

    methods : {

        backHandler : function(){

            this.$emit('event_child', 'button-labels');
        }, 



    },

    created : function(){
        this.$http.get('https://google.com', (data) => {
            console.log( data );
          })
          .error((err) => console.log(err))
    },



})


new Vue({
  el: '#app',
  data : {
     labels : [

        { id : 1, label : "Search" } , { id : 2, label: "Categories"  },  { id : 3, label: "Favorites" }, {id : 4, label: "Settings"}
    ],
    currentView : "button-labels",
  },

  methods : {

    eventChild : function(label)
    {
        this.currentView = label;
    }

  }


})

这是我的package.json

{
  "scripts": {
    "transpile-es2015": "babel src -d lib"
  },
  "devDependencies": {
    "babel-core": "^6.1.2",
    "babel-loader": "^6.1.0",
    "babel-plugin-transform-runtime": "^6.1.2",
    "babel-preset-es2015": "^6.1.2",
    "babel-runtime": "^6.0.14",
    "css-loader": "^0.21.0",
    "style-loader": "^0.13.0",
    "vue-hot-reload-api": "^1.2.1",
    "vue-html-loader": "^1.0.0",
    "vue-loader": "^7.0.1",
    "webpack": "^1.12.3",
    "webpack-dev-server": "^1.12.1"
  },
  "dependencies": {
    "bootstrap": "^3.3.5",
    "vue-resource": "^0.1.17",
    "vue-router": "^0.7.5",
    "vue": "^1.0.7"
  }
}

0 个答案:

没有答案