优化内链iframe没有传递参数

This commit is contained in:
不做码农 2023-11-26 12:15:52 +08:00
parent fb517dd799
commit e1879c706c

View File

@ -5,7 +5,8 @@
:key="item.path"
:iframeId="'iframe' + index"
v-show="route.path === item.path"
:src="item.meta.link"></inner-link>
:src="iframeUrl(item.meta.link, item.query)">
</inner-link>
</transition-group>
</template>
@ -15,4 +16,14 @@ import useTagsViewStore from '@/store/modules/tagsView'
const route = useRoute()
const tagsViewStore = useTagsViewStore()
function 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
}
</script>