const state = {
    news: []
}

const mutations = {
    setNews(state, news) {
        state.news = news
    }
}

const actions = {
    fetchNews({ commit }) {
        // 模拟API调用
        const news = [
            { id: 1, title: 'News 1' },
            { id: 2, title: 'News 2' }
        ]
        commit('setNews', news)
    }
}

const getters = {
    allNews: state => state.news
}

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