const state = {
    users: []
}

const mutations = {
    setUsers(state, users) {
        state.users = users
    }
}

const actions = {
    fetchUsers({ commit }) {
        // 模拟API调用
        const users = [
            { id: 1, name: 'User 1' },
            { id: 2, name: 'User 2' }
        ]
        commit('setUsers', users)
    }
}

const getters = {
    allUsers: state => state.users
}

export default {
    namespaced: true,
    state,
    mutations,
    actions,
    getters
}
