dataease/frontend/src/components/canvas/custom-component/DeFrame.vue

136 lines
2.8 KiB
Vue
Raw Normal View History

2022-03-27 19:06:37 +08:00
<template>
<el-row class="main-frame">
<div v-if="element.frameLinks.src" class="main-frame">
<iframe v-if="frameShow" id="iframe" :src="element.frameLinks.src" scrolling="auto" frameborder="0" class="main-frame" @load="loaded" @error="onError" />
<div v-if="editMode==='edit'" class="frame-mask edit-mask">
2022-03-27 19:06:37 +08:00
<span style="opacity: 1;">
<span style="font-weight: bold;color: lawngreen;">{{ $t('panel.edit_web_tips') }}</span>
</span>
</div>
<!--Here are three 15px wide masks(left top right) for easy clicking on the display jump button-->
<div v-if="editMode!=='edit'" class="frame-mask preview-top-mask" />
<div v-if="editMode!=='edit'" class="frame-mask preview-right-mask" />
<div v-if="editMode!=='edit'" class="frame-mask preview-left-mask" />
2022-03-30 11:01:01 +08:00
<div v-if="screenShot" class="frame-mask" />
2022-03-27 19:06:37 +08:00
</div>
<div v-else class="info-class">
{{ $t('panel.web_add_tips') }}
</div>
</el-row>
</template>
<script>
import { mapState } from 'vuex'
import bus from '@/utils/bus'
2022-03-27 19:06:37 +08:00
export default {
2022-03-30 11:01:01 +08:00
name: 'DeFrame',
2022-03-27 19:06:37 +08:00
props: {
propValue: {
type: String,
require: true
},
element: {
type: Object
},
editMode: {
type: String,
require: false,
default: 'edit'
},
active: {
type: Boolean,
require: false,
default: false
2022-03-30 11:01:01 +08:00
},
screenShot: {
type: Boolean,
default: false
2022-03-27 19:06:37 +08:00
}
},
data() {
return {
pOption: {},
frameShow: true
2022-03-27 19:06:37 +08:00
}
},
computed: {
...mapState([
'componentGap',
'canvasStyleData'
])
},
watch: {
h(newVal, oldVla) {
}
},
created() {
},
mounted() {
bus.$on('frameLinksChange-' + this.element.id, () => {
this.frameShow = false
this.$nextTick(() => {
this.frameShow = true
})
})
2022-03-27 19:06:37 +08:00
},
methods: {
2022-03-30 11:01:01 +08:00
loaded(e) {
},
onError(e) {
}
2022-03-27 19:06:37 +08:00
}
}
</script>
<style>
.info-class{
text-align: center;
height: 100%;
display: flex;
align-items: center;
justify-content: center;
background-color: #FFFFFF;
font-size: 12px;
color: #9ea6b2;
}
.main-frame{
height: 100%;
width: 100%;
}
.frame-mask {
display: flex;
opacity: 0.5;
position:absolute;
top:0px;
z-index: 1;
2022-03-27 19:06:37 +08:00
display: flex;
align-items: center;
justify-content: center;
}
.edit-mask{
left: 0px;
background-color: #5c5e61;
height: 100%!important;
width: 100% !important;
}
.preview-top-mask{
left: 0px;
height: 15px!important;
width: 100% !important;
}
.preview-right-mask{
right: 0px;
height: 100%!important;
width: 15px !important;
}
.preview-left-mask{
left: 0px;
height: 100%!important;
width: 15px !important;
}
2022-03-27 19:06:37 +08:00
</style>