vuex清掉資料 如何重置 擦除vuex儲存資料?

2021-10-13 07:58:16 字數 955 閱讀 4773

在我/src/store/資料夾我有actions.js,index.js,mutations.js和state.js它包含以下資訊如何重置/擦除vuex儲存資料?

actions.js

export default {}

index.js

import vue from 'vue'

import vuex from 'vuex'

import state from './state'

import actions from './actions'

import mutations from './mutations'

vue.use(vuex)

export default new vuex.store(],

notifications: ,

tasks:

現在,當使用者登入時,我保持狀態的

this.$store.commit('set_user', response.data)

現在,當使用者登出時,我跑我components/logout.vue檔案,在其中它有以下**:

export default ,

created() {

localstorage.setitem('vuex', null);

this.$store.commit('set_user', null);

window.localstorage.clear();

window.sessionstorage.clear();

但由於某種原因,資料以某種方式持續存在。

2017-09-13

hidar

+0'但由於某些原因,該資料以某種方式persisted.'持久儲存在**?在'state.user'或localstorage中? –

+0它堅持'state.user' –

+0我不確定最新錯誤,同樣的作品[這裡]( –

vue 重置vuex資料

有時候在我們把資料儲存下來的時候,在某個時候需要移除這些資料卻不知道怎麼移除了 下面我有一些自己的方法 一 dispatch重新賦值 store.js const actions targetuser vue頁面 賦空值 methods 方法二 在actions定義乙個方法 const action...

MYSQL資料庫忘記root密碼如何重置

昨天重新複習了一下mysql資料庫的相關知識,今天隨手寫乙個簡單的知識點 如查忘記了mysql資料庫的root使用者的密碼,該怎麼辦呢?systemctl stop mariadb usr local mysql bin mysqld safe skip grant table mysql u ro...

如果您遇到檔案或資料庫問題,如何重置Joomla

如果您遇到joomla站點的問題,那麼重新安裝其核心檔案和資料庫可能是最佳解決方案。了解問題 這種方法無法解決您的所有問題。但它主要適用於由joomla核心引起的問題。執行joomla核心更新後,這些型別的問題通常會出現。如果由於某種原因,例如,伺服器資源耗盡或錯誤,只有一些檔案得到更新,您可能經常...