【发布时间】:2021-07-31 14:58:32
【问题描述】:
请帮我解决这个问题,我正在使用 vue js v2 并且我也是新手,但是我遇到了一些无法读取提交的问题。当我通过保护路由登录并重定向到我的仪表板时
谁能帮帮我?
store.js
import Vue from 'vue'
import Vuex from 'vuex'
Vue.use(Vuex)
const store = new Vuex.Store({
state:{
authenticated: false
},
mutations: {
setAuthentication(state, status){
state.authenticated = status
}
},
})
export default store
方法
methods: {
login(){
axios.post('/api/v1/login', this.form)
.then(response =>{
// this.$router.push('dashboard')
this.$store.commit('setAuthentication', true);
this.$router.replace({name: 'dashboard'})
})
}
}
【问题讨论】:
标签: laravel vue.js vuex vue-router