import api from '~api'
const actions = {
async ['get']({commit, rootState: {route: { path }}}, config = {}) {
const { data: { code, data } } = await api.post(config.url, config.data)
if (code === 1001) commit('receive', data)
}
}
const mutations = {
['receive'](state, data) {
state.data = [].concat(data)
},
['modify'](state, payload) {
const index = state.data.findIndex(item => item.id === payload.id)
if (index > -1) {
state.data.splice(index, 1, payload)
}
},
['insert'](state, payload) {
state.data = [payload].concat(state.data)
},
['remove'](state, id) {
const index = state.data.findIndex(item => item.id === id)
state.data.splice(index, 1)
}
}
const getters = {
['get'](state) {
return state.data
}
}
export const _actions = actions
export const _mutations = mutations
export const _getters = getters
export default {
namespaced: true,
actions,
mutations,
getters
}
import Vue from 'vue'
import Vuex from 'vuex'
import lists from './general/lists'
Vue.use(Vuex)
export default new Vuex.Store({
namespaced: true,
modules: {
base: {
namespaced: true,
modules: {
app: {...lists, state: { lists: { data: [], total: 0, current_page: 1 } }},
platform: {...lists, state: { lists: { data: [], total: 0, current_page: 1 } }},
product: {
namespaced: true,
modules: {
category: {...lists, state: { lists: { data: [], total: 0, current_page: 1 } }},
}
},
keyword: {
namespaced: true,
modules: {
username: {...lists, state: { lists: { data: [], total: 0, current_page: 1 } }},
}
},
}
},
buzz: {
namespaced: true,
modules: {
shop: {...lists, state: { lists: { data: [], total: 0, current_page: 1 } }},
}
}
})
import api from '~api'
const actions = {
async ['get']({commit, rootState: {route: { path }}}, config = {}) {
const { data: { code, data } } = await api.post(config.url, config.data)
if (code === 1001) commit('receive', data)
}
}
const mutations = {
['receive'](state, data) {
state.data = [].concat(data)
},
['modify'](state, payload) {
const index = state.data.findIndex(item => item.id === payload.id)
if (index > -1) {
state.data.splice(index, 1, payload)
}
},
['insert'](state, payload) {
state.data = [payload].concat(state.data)
},
['remove'](state, id) {
const index = state.data.findIndex(item => item.id === id)
state.data.splice(index, 1)
}
}
const getters = {
['get'](state) {
return state.data
}
}
export const _actions = actions
export const _mutations = mutations
export const _getters = getters
export default {
namespaced: true,
state() {
return { lists: { data: [], total: 0, current_page: 1 } }
},
actions,
mutations,
getters
}
import Vue from 'vue'
import Vuex from 'vuex'
import lists from './general/lists'
Vue.use(Vuex)
export default new Vuex.Store({
namespaced: true,
modules: {
base: {
namespaced: true,
modules: {
app: lists,
platform: lists,
product: {
namespaced: true,
modules: {
category: lists,
}
},
keyword: {
namespaced: true,
modules: {
username: lists,
}
},
}
},
buzz: {
namespaced: true,
modules: {
shop: lists,
}
}
})
机械节能产品生产企业官网模板...
大气智能家居家具装修装饰类企业通用网站模板...
礼品公司网站模板
宽屏简约大气婚纱摄影影楼模板...
蓝白WAP手机综合医院类整站源码(独立后台)...苏ICP备2024110244号-2 苏公网安备32050702011978号 增值电信业务经营许可证编号:苏B2-20251499 | Copyright 2018 - 2025 源码网商城 (www.ymwmall.com) 版权所有