モバイル版のウィジェット復活
This commit is contained in:
@ -3,6 +3,7 @@ import MiOS from './mios';
|
||||
|
||||
const defaultSettings = {
|
||||
home: [],
|
||||
mobileHome: [],
|
||||
fetchOnScroll: true,
|
||||
showMaps: true,
|
||||
showPostFormOnTopOfTl: false,
|
||||
@ -58,6 +59,25 @@ export default (os: MiOS) => new Vuex.Store({
|
||||
|
||||
addHomeWidget(state, widget) {
|
||||
state.data.home.unshift(widget);
|
||||
},
|
||||
|
||||
setMobileHome(state, data) {
|
||||
state.data.mobileHome = data;
|
||||
},
|
||||
|
||||
setMobileHomeWidget(state, x) {
|
||||
const w = state.data.mobileHome.find(w => w.id == x.id);
|
||||
if (w) {
|
||||
w.data = x.data;
|
||||
}
|
||||
},
|
||||
|
||||
addMobileHomeWidget(state, widget) {
|
||||
state.data.mobileHome.unshift(widget);
|
||||
},
|
||||
|
||||
removeMobileHomeWidget(state, widget) {
|
||||
state.data.mobileHome = state.data.mobileHome.filter(w => w.id != widget.id);
|
||||
}
|
||||
},
|
||||
|
||||
@ -85,6 +105,22 @@ export default (os: MiOS) => new Vuex.Store({
|
||||
os.api('i/update_home', {
|
||||
home: ctx.state.data.home
|
||||
});
|
||||
},
|
||||
|
||||
addMobileHomeWidget(ctx, widget) {
|
||||
ctx.commit('addMobileHomeWidget', widget);
|
||||
|
||||
os.api('i/update_mobile_home', {
|
||||
home: ctx.state.data.mobileHome
|
||||
});
|
||||
},
|
||||
|
||||
removeMobileHomeWidget(ctx, widget) {
|
||||
ctx.commit('removeMobileHomeWidget', widget);
|
||||
|
||||
os.api('i/update_mobile_home', {
|
||||
home: ctx.state.data.mobileHome.filter(w => w.id != widget.id)
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user