feat:预览界面点击组件显示设置入口,点击空白也取消设置入口;去掉原有鼠标移入显示的样式

This commit is contained in:
wangjiahao 2021-08-03 11:31:17 +08:00
parent 2bbca0e525
commit 7960180858
2 changed files with 32 additions and 3 deletions

View File

@ -4,7 +4,9 @@
:class="{'gap_class':canvasStyleData.panel.gap==='yes'}"
class="component"
@click="handleClick"
@mousedown="elementMouseDown"
>
<edit-bar v-if="config === curComponent" />
<de-out-widget
v-if="config.type==='custom'"
:id="'component' + config.id"
@ -33,8 +35,10 @@ import runAnimation from '@/components/canvas/utils/runAnimation'
import { mixins } from '@/components/canvas/utils/events'
import { mapState } from 'vuex'
import DeOutWidget from '@/components/dataease/DeOutWidget'
import EditBar from '@/components/canvas/components/Editor/EditBar'
export default {
components: { DeOutWidget },
components: { DeOutWidget, EditBar },
mixins: [mixins],
props: {
config: {
@ -60,7 +64,8 @@ export default {
},
computed: {
...mapState([
'canvasStyleData'
'canvasStyleData',
'curComponent'
])
},
mounted() {
@ -94,6 +99,17 @@ export default {
Object.keys(events).forEach(event => {
this[event](events[event])
})
},
elementMouseDown(e) {
debugger
// private
this.$store.commit('setClickComponentStatus', true)
if (this.config.component !== 'v-text' && this.config.component !== 'rect-shape' && this.config.component !== 'de-input-search' && this.config.component !== 'de-number-range') {
e.preventDefault()
}
//
e.stopPropagation()
this.$store.commit('setCurComponent', { component: this.config, index: this.index })
}
}
}

View File

@ -1,5 +1,5 @@
<template>
<div id="canvasInfoTemp" :style="customStyle" class="bg">
<div id="canvasInfoTemp" :style="customStyle" class="bg" @mouseup="deselectCurComponent" @mousedown="handleMouseDown">
<el-row v-if="componentDataShow.length===0" style="height: 100%;" class="custom-position">
{{ $t('panel.panelNull') }}
</el-row>
@ -121,6 +121,8 @@ export default {
return this.componentDataShow
},
...mapState([
'isClickComponent',
'curComponent',
'componentData',
'canvasStyleData'
])
@ -204,6 +206,17 @@ export default {
},
exportExcel() {
this.$refs['userViewDialog'].exportExcel()
},
deselectCurComponent(e) {
debugger
if (!this.isClickComponent) {
this.$store.commit('setCurComponent', { component: null, index: null })
}
},
handleMouseDown() {
// console.log('handleMouseDown123')
this.$store.commit('setClickComponentStatus', false)
}
}
}