vue-sessionstorage 浅浅的花香味﹌ 2022-02-02 10:53 203阅读 0赞 > Install npm install --save vue-sessionstorage > main.js import VueSessionStorage from 'vue-sessionstorage' Vue.use(VueSessionStorage) > 方法 this.$session.get(key) this.$session.set(key, value) this.$session.exists(key) this.$session.remove(key) this.$session.clear(key) > 实例 export default { name: 'login', methods: { doLogin() { axios.post('/login', {...}).then(response => { let username = response.data.username; this.$session.set('username', username); // Set the username in session Storage }); } } }
还没有评论,来说两句吧...