Files
learning-system-portal/src/components/Course/hyperLink.vue
2023-01-02 17:43:53 +08:00

72 lines
1.9 KiB
Vue

<template>
<div class="hyper-index">
<div>
<!-- <div class="hyper-link" v-if="!showiframe">
<div class="hyper-link-row">{{content.contentName}}</div>
<div class="hyper-link-row">{{content.content}}</div>
<div class="hyper-link-row">
<el-button @click="showiframe = true" type="warning">本页面打开</el-button>
<el-button @click="widthOpen(content.content)" type="primary">新窗口打开</el-button>
</div>
</div>
<div v-if="showiframe">
<iframe :src="content.content" style="width: 100%;border:0px;min-height: 473px;" frameborder="0"></iframe>
</div> -->
<div class="hyper-link" v-if="conLink.openType==2">
<div class="hyper-link-row">{{content.contentName}}</div>
<div class="hyper-link-row">{{conLink.url}}</div>
</div>
<div v-if="conLink.openType==1">
<iframe :src="conLink.url" style="width: 100%;border:0px;min-height: 473px;" frameborder="0"></iframe>
</div>
</div>
</div>
</template>
<script>
export default {
props:{
content: {
type: Object,
default:()=>{}
}
},
data() {
return {
showiframe:false,
conLink:{openType:1,url:''}
};
},
mounted() {
if(this.content.content.startsWith('\{')){
this.conLink=JSON.parse(this.content.content);
}else{
this.conLink.url=this.content.content;
this.conLink.openType=1;
}
if(this.conLink.openType==2){
//直接设置完成状态
this.widthOpen(this.conLink.url);
}
},
methods: {
widthOpen(url) {
window.open(this.webBaseUrl+url,'_blank');
}
}
}
</script>
<style scoped lang="scss">
.hyper-index{
.hyper-link{
padding-left:20px;
text-align: center;
padding-top: 100px;
.hyper-link-row{
padding: 20px;
}
}
}
</style>