first commit

This commit is contained in:
编码猿
2024-09-27 02:06:13 +08:00
commit 852d94fbb9
36760 changed files with 3274413 additions and 0 deletions

View File

@@ -0,0 +1,54 @@
import Vuex from 'vuex'
import Vue from 'vue'
Vue.use(Vuex)
const store = new Vuex.Store({
// 只负责存储数据,一般不建议在程序里面直接对 state 数据进行读取修改
// 读:getters
// 写:mutations
state: {
showNavbars: true,
showTabbars: true,
MessageList: [],
onLineUser: null
},
// 读取 state 里面的数据的过程
getters: {
getMessageList: state => {
return state.MessageList
},
getShowNavbars: state => {
return state.showNavbars
},
getShowTabbars: state => {
return state.showTabbars
},
getonLineUser: state => {
return state.onLineUser
}
},
// 修改 state 里面的数据的过程
mutations: {
addMessageList (state, list) {
state.MessageList.push(list)
},
setShowNavbars(state, status) {
state.showNavbars = status
},
setShowTabbars(state, status) {
state.showTabbars = status
},
setonLineUser(state, status) {
state.onLineUser = status
}
},
// 表示动作,一般开发套路是:通过action触发 mutations,然后 mutations 修改
// state
actions: {
increment (context) {
context.commit('increment','你好')
}
}
});
export default store;