博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
vuex简单存储登录用户数据
阅读量:4555 次
发布时间:2019-06-08

本文共 587 字,大约阅读时间需要 1 分钟。

一,

let obj = this.qs.stringify({      }) this.$axios.post('调取的接口', obj, res => {    console.log(res.code);                                 localStorage.setItem('token',this.logindata.token)                         this.$store.state.token=this.logindata.token;         this.$router.push({        path: '/index'    });  })

二,

  vuex(存储数据)

import Vue from 'vue';import Vuex from 'vuex'; Vue.use(Vuex);const state={    token:''||localStorage.getItem('token')}const mutations={    } export default new Vuex.Store({  state,  mutations});

 

转载于:https://www.cnblogs.com/liujiajiablog/p/10335756.html

你可能感兴趣的文章
SQL优化方法
查看>>
SEO必须掌握的高级搜索指令
查看>>
生产者消费者模型
查看>>
ORACLE 字符串超长问题解决方案
查看>>
使用ZooKeeper协调多台Web Server的定时任务处理(方案1)
查看>>
20171116 每周例行报告
查看>>
[C#] SHA1校验函数用法
查看>>
linux 下 VMware 提示Unable to change virtual machine power state:
查看>>
洛谷P1585 魔法阵
查看>>
线程 题待做
查看>>
PL/SQL可以连oracle,但是jdbc连不上 【转】
查看>>
使用 highlight.js 在网页中高亮显示java 代码 【原】
查看>>
[转]高颜值、好用、易扩展的微信小程序 UI 库,Powered by 有赞
查看>>
[转]SQL Server如何启用xp_cmdshell组件
查看>>
[转]微擎应用笔记3--manifest.xml文件使用说明
查看>>
Codeforces 1000C Covered Points Count 【前缀和优化】
查看>>
python高效读取文件、文件改写
查看>>
gulp
查看>>
pgsql查询优化之模糊查询
查看>>
[转]-Gradle使用手册(三):构建任务
查看>>