新建一个页面
<template>
<div class="outer-frame-wrapper">
<iframe :key="url" frameborder="0" :src="url" class="outer-frame">
</iframe>
<div class="top-back" @click="goBack"></div>
</div>
</template>
<script>
export default {
name: 'outerFrame',
data(){
return {
url: ''
}
},
created(){
this.url = decodeURIComponent(this.$route.query.path)
},
methods: {
goBack(){
this.$router.go(-1)
}
}
};
</script>
<style scoped>
.outer-frame-wrapper{
width: 100%;
height: 100%;
position: relative;
}
.outer-frame-wrapper iframe.outer-frame{
width: 100%;
height: 100%;
}
.outer-frame-wrapper .top-back{
position: absolute;
top: 0;
margin: 0 35%;
width: 30%;
height: 80px;
cursor: pointer;
z-index: 999;
}
</style>
跳转时使用
this.$router.push({
path: "/outerFrame",
query: {
path: `http//`,
},
});