store.js 599 B

123456789101112131415161718192021222324252627
  1. import { createStore } from "framework7/lite";
  2. const store = createStore({
  3. state: {
  4. radios: {
  5. "https://www.ondarossa.info": {
  6. name: "ROR",
  7. },
  8. "https://radiospore.oziosi.org": {
  9. name: "Spore",
  10. },
  11. },
  12. },
  13. getters: {
  14. radios({state}) {
  15. return state.radios
  16. },
  17. },
  18. actions: {
  19. cambia({state}, {base }) {
  20. const oneRadio = Object.keys(state.radios)[0]
  21. const prevValue = state.radios[oneRadio].name
  22. state.radios[oneRadio].name = prevValue.split(" ")[0] + " " + (base+Math.random())
  23. }
  24. },
  25. });
  26. export default store;