iframe.js 799 B

1234567891011121314151617181920212223242526272829303132333435363738
  1. export default {
  2. state: {
  3. iframeList: []
  4. },
  5. mutations: {
  6. setIframeList(state, route){
  7. state.iframeList = []
  8. state.iframeList.push(route)
  9. },
  10. pushIframeList(state, route){
  11. let target = state.iframeList.find((item) => item.path === route.path)
  12. if(!target){
  13. state.iframeList.push(route)
  14. }
  15. },
  16. removeIframeList(state, route){
  17. state.iframeList.forEach((item, index) => {
  18. if (item.path === route.path){
  19. state.iframeList.splice(index, 1)
  20. }
  21. })
  22. },
  23. refreshIframe(state, route){
  24. state.iframeList.forEach((item) => {
  25. if (item.path == route.path){
  26. var url = route.meta.url;
  27. item.meta.url = '';
  28. setTimeout(function() {
  29. item.meta.url = url
  30. }, 200);
  31. }
  32. })
  33. },
  34. clearIframeList(state){
  35. state.iframeList = []
  36. }
  37. }
  38. }