首页 > 解决方案 > Vue.js 使用 POST 错误(Sysntax 但未找到)

问题描述

感谢您阅读这个问题。

我有一个语法错误,但我找不到在哪里。

我正在使用 Vue.js 和引导程序,我正在研究购物车功能。为了使端点工作,您需要传递一个特殊的身份验证标头:

授权:kazuhisa.noguchi.ghsd75@gmail.com

import Vue from 'vue'
import App from './App.vue'
import BootstrapVue from 'bootstrap-vue'
import VueRouter from 'vue-router'
import 'bootstrap/dist/css/bootstrap.css'
import 'bootstrap-vue/dist/bootstrap-vue.css'
import MainPage from './components/MainPage.vue'
import HelpPage from './components/HelpPage.vue'
import ProductPage from './components/ProductPage.vue'
import CategoryPage from './components/CategoryPage.vue'

Vue.config.productionTip = false
Vue.use(BootstrapVue)
Vue.use(VueRouter)

const router = new VueRouter({
  routes: [{
      path: '/',
      component: MainPage
    },
    {
      path: '/help',
      component: HelpPage
    },
    {
      path: '/products/:productId',
      component: ProductPage
    },
    {
      path: '/categories/:categoryAlias',
      component: CategoryPage
    }
  ],
  mode: 'history'
})

axios.defaults.headers.common['Authorization'] = 'azuhisa.noguchi.ghsd75@gmail.com';

axios.post("https://euas.person.ee/user/carts/").then(
  response => {
    new Vue({
      render: h => h(App),
      router: router,
      data: {
        cart: response.data,
        saveCard() {
          axios.put("https://euas.person.ee/user/carts/" +
            this.cart.id, this.cart)
        }
      }
    }).$mount('#app')
  }
};

尽我所能,

标签: vue.js

解决方案


推荐阅读