fix 修复 内链iframe没有传递参数问题

This commit is contained in:
疯狂的狮子Li 2023-11-10 11:35:34 +08:00
parent f65eb2aee5
commit 8a7de17b58

View File

@ -5,7 +5,7 @@
:key="item.path" :key="item.path"
:iframeId="'iframe' + index" :iframeId="'iframe' + index"
v-show="route.path === item.path" v-show="route.path === item.path"
:src="item.meta ? item.meta.link : ''" :src="iframeUrl(item.meta ? item.meta.link : '', item.query)"
></inner-link> ></inner-link>
</transition-group> </transition-group>
</template> </template>
@ -15,5 +15,13 @@ import InnerLink from "../InnerLink/index.vue";
import useTagsViewStore from '@/store/modules/tagsView'; import useTagsViewStore from '@/store/modules/tagsView';
const route = useRoute(); const route = useRoute();
const tagsViewStore = useTagsViewStore() const tagsViewStore = useTagsViewStore();
function iframeUrl(url: string, query: any) {
if (Object.keys(query).length > 0) {
let params = Object.keys(query).map((key) => key + "=" + query[key]).join("&");
return url + "?" + params;
}
return url;
}
</script> </script>