added vuex

This commit is contained in:
AndzejsP 2023-06-13 18:09:25 +03:00
parent 08083e9ae4
commit dc29926c91
5 changed files with 38 additions and 4 deletions

14
web/package-lock.json generated
View File

@ -18,7 +18,8 @@
"papaparse": "^5.4.1",
"socket.io-client": "^4.6.1",
"vue": "^3.2.47",
"vue-router": "^4.1.6"
"vue-router": "^4.1.6",
"vuex": "^4.0.2"
},
"devDependencies": {
"@rushstack/eslint-patch": "^1.2.0",
@ -3187,6 +3188,17 @@
"vue": "^3.2.0"
}
},
"node_modules/vuex": {
"version": "4.0.2",
"resolved": "https://registry.npmjs.org/vuex/-/vuex-4.0.2.tgz",
"integrity": "sha512-M6r8uxELjZIK8kTKDGgZTYX/ahzblnzC4isU1tpmEuOIIKmV+TRdc+H4s8ds2NuZ7wpUTdGRzJRtoj+lI+pc0Q==",
"dependencies": {
"@vue/devtools-api": "^6.0.0-beta.11"
},
"peerDependencies": {
"vue": "^3.0.2"
}
},
"node_modules/which": {
"version": "2.0.2",
"resolved": "https://registry.npmjs.org/which/-/which-2.0.2.tgz",

View File

@ -20,7 +20,8 @@
"papaparse": "^5.4.1",
"socket.io-client": "^4.6.1",
"vue": "^3.2.47",
"vue-router": "^4.1.6"
"vue-router": "^4.1.6",
"vuex": "^4.0.2"
},
"devDependencies": {
"@rushstack/eslint-patch": "^1.2.0",

View File

@ -1,4 +1,5 @@
import { createApp } from 'vue'
import { createStore } from 'vuex'
import App from './App.vue'
import router from './router'
@ -6,6 +7,23 @@ import './assets/tailwind.css'
const app = createApp(App)
// Create a new store instance.
const store = createStore({
state () {
return {
count: 0,
settingsChanged:Boolean
}
},
mutations: {
increment (state) {
state.count++
}
}
})
app.use(router)
app.use(store)
app.mount('#app')

View File

@ -1150,7 +1150,8 @@ export default {
},
async activated() {
console.log('settings changed',this.$store.state.settingsChanged)
// This lifecycle hook runs every time you switch from other page back to this page (vue-router)
// To fix scrolling back to last message, this hook is needed.
// If anyone knows hor to fix scroll issue when changing pages, please do fix it :D

View File

@ -1632,7 +1632,9 @@ export default {
})
},
settingsChanged() {
settingsChanged(val) {
this.$store.state.settingsChanged=val
//this.$store.settingsChanged=val
nextTick(() => {
feather.replace()