demo.vue 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  1. <template>
  2. </template>
  3. <script setup>
  4. export default {
  5. data() {
  6. return {}
  7. },
  8. created() {
  9. let path = window.location.pathname
  10. // alert(path)
  11. console.log('window.path',window)
  12. let paths = [{
  13. path:'/jczl1',
  14. redirect:'/jczl'
  15. },{
  16. path:'/sprh1',
  17. redirect:'/sprh'
  18. },{
  19. path:'/yshj1',
  20. redirect:'/yshj'
  21. },{
  22. path:'/yshj_new1',
  23. redirect:'/yshj_new'
  24. },{
  25. path:'/weather1',
  26. redirect:'/weather'
  27. },{
  28. path:'/aqyj1',
  29. redirect:'/aqyj'
  30. },{
  31. path:'/fwyq1',
  32. redirect:'/fwyq'
  33. },{
  34. path:'/jjyx1',
  35. redirect:'/jjyx'
  36. },{
  37. path:'/csgl1',
  38. redirect:'/csgl'
  39. },{
  40. path:'/bjzshz1',
  41. redirect:'/bjzshz'
  42. }];
  43. let redirect = '';
  44. for (let i = 0; i < paths.length; i++) {
  45. if(paths[i].path === path){
  46. redirect = paths[i].redirect;
  47. }
  48. }
  49. // 前端大屏新窗口 跳转
  50. let routeUrl = this.$router.resolve({
  51. path: redirect
  52. });
  53. this.$store.dispatch("tagsView/delView", this.$route);
  54. // 返回上一页面
  55. this.$router.go(-1);
  56. //新窗口打开页面
  57. window.open(routeUrl.href, '_blank');
  58. //原窗口保持原来的页面
  59. return 0;
  60. // }
  61. },
  62. }
  63. </script>
  64. <style scoped lang="scss">
  65. </style>