You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 

44 lines
677 B

import {
api
} from '@/api'
const state = {
banner: []
}
const getters = {
bannerCount: state => {
return state.banner.length
}
}
const actions = {
getBanner({
commit
}) {
api.get('banner/list', {
params: {
categoryid: 1
}
}).then(res => {
commit('setBanner', res.data.banner)
})
}
}
const mutations = {
setBanner(state, banner) {
state.banner = banner
},
removeLast(state) {
state.banner.splice(state.banner.length - 1, 1)
}
}
export default {
namespaced: true,
state,
actions,
getters,
mutations
}