mirror of
https://github.com/KevinMidboe/leifsopplevelser.git
synced 2025-10-29 09:40:21 +00:00
Increment logic added before it should, this is now fixed. Also changed the name of some input function paramteres to make more sense.
This commit is contained in:
23
src/store.js
23
src/store.js
@@ -6,7 +6,8 @@ Vue.use(Vuex)
|
|||||||
const state = {
|
const state = {
|
||||||
popover: false,
|
popover: false,
|
||||||
popoverAlbum: [],
|
popoverAlbum: [],
|
||||||
popoverAlbumIndex: 0,
|
popoverAlbumLength: 0,
|
||||||
|
popoverAlbumIndex: 0
|
||||||
}
|
}
|
||||||
|
|
||||||
const mutations = {
|
const mutations = {
|
||||||
@@ -20,18 +21,20 @@ const mutations = {
|
|||||||
|
|
||||||
setPopoverAlbum (state, album) {
|
setPopoverAlbum (state, album) {
|
||||||
state.popoverAlbum = album;
|
state.popoverAlbum = album;
|
||||||
|
state.popoverAlbumLength = album.length - 1;
|
||||||
},
|
},
|
||||||
|
|
||||||
setPopoverAlbumIndex (state, index) {
|
setPopoverAlbumIndex (state, index) {
|
||||||
state.popoverAlbumIndex = index;
|
state.popoverAlbumIndex = index;
|
||||||
|
console.log('new index', index);
|
||||||
},
|
},
|
||||||
|
|
||||||
incrementPopoverImage (state) {
|
incrementPopoverImage (state) {
|
||||||
let index = state.popoverAlbumIndex;
|
let index = state.popoverAlbumIndex;
|
||||||
index++
|
|
||||||
console.log('Setting popover index:', index)
|
|
||||||
|
|
||||||
if (index > state.popoverAlbum.length - 1) {
|
if (index < state.popoverAlbumLength) {
|
||||||
|
index++;
|
||||||
|
} else {
|
||||||
index = 0;
|
index = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -40,11 +43,11 @@ const mutations = {
|
|||||||
|
|
||||||
decrementPopoverImage (state) {
|
decrementPopoverImage (state) {
|
||||||
let index = state.popoverAlbumIndex;
|
let index = state.popoverAlbumIndex;
|
||||||
index--
|
|
||||||
console.log('Setting popover index:', index)
|
|
||||||
|
|
||||||
if (index < 0) {
|
if (index > 0) {
|
||||||
index = state.popoverAlbum.length - 1;
|
index--;
|
||||||
|
} else {
|
||||||
|
index = state.popoverAlbumLength;
|
||||||
}
|
}
|
||||||
|
|
||||||
state.popoverAlbumIndex = index;
|
state.popoverAlbumIndex = index;
|
||||||
@@ -55,8 +58,8 @@ const mutations = {
|
|||||||
const actions = {
|
const actions = {
|
||||||
showPopover: ({ commit }) => commit('showPopover'),
|
showPopover: ({ commit }) => commit('showPopover'),
|
||||||
hidePopover: ({ commit }) => commit('hidePopover'),
|
hidePopover: ({ commit }) => commit('hidePopover'),
|
||||||
setPopoverAlbum: ({ commit }, payload) => commit('setPopoverAlbum', payload),
|
setPopoverAlbum: ({ commit }, images) => commit('setPopoverAlbum', images),
|
||||||
setPopoverAlbumIndex: ({ commit }, payload) => commit('setPopoverAlbumIndex', payload),
|
setPopoverAlbumIndex: ({ commit }, index) => commit('setPopoverAlbumIndex', index),
|
||||||
incrementPopoverImage: ({ commit }) => commit('incrementPopoverImage'),
|
incrementPopoverImage: ({ commit }) => commit('incrementPopoverImage'),
|
||||||
decrementPopoverImage: ({ commit }) => commit('decrementPopoverImage'),
|
decrementPopoverImage: ({ commit }) => commit('decrementPopoverImage'),
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user