Browse Source

修复内链iframe没有传递参数问题(I8DUOJ)

RuoYi 1 year ago
parent
commit
b357aedaa3
1 changed files with 12 additions and 3 deletions
  1. 12 3
      ruoyi-ui/src/layout/components/IframeToggle/index.vue

+ 12 - 3
ruoyi-ui/src/layout/components/IframeToggle/index.vue

@@ -5,19 +5,28 @@
       :key="item.path"
       :iframeId="'iframe' + index"
       v-show="$route.path === item.path"
-      :src="item.meta.link"
+      :src="iframeUrl(item.meta.link, item.query)"
     ></inner-link>
   </transition-group>
 </template>
 
 <script>
-import InnerLink from "../InnerLink/index"
+import InnerLink from "../InnerLink/index";
 
 export default {
   components: { InnerLink },
   computed: {
     iframeViews() {
-      return this.$store.state.tagsView.iframeViews
+      return this.$store.state.tagsView.iframeViews;
+    }
+  },
+  methods: {
+    iframeUrl(url, query) {
+      if (Object.keys(query).length > 0) {
+        let params = Object.keys(query).map((key) => key + "=" + query[key]).join("&");
+        return url + "?" + params;
+      }
+      return url;
     }
   }
 }