fix: 文本搜索组件在预览和编辑时显示不一致 (#1529)

fix: 文本搜索组件在预览和编辑时显示不一致
This commit is contained in:
fit2cloudrd 2021-12-27 16:34:27 +08:00 committed by GitHub
parent 46c45315db
commit c8814f9daa
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 27 additions and 10 deletions

View File

@ -15,6 +15,7 @@
:out-style="config.style"
:element="config"
:in-screen="inScreen"
:edit-mode="'preview'"
:h="config.style.height"
/>
<component

View File

@ -44,6 +44,7 @@
<script>
import elementResizeDetectorMaker from 'element-resize-detector'
import { mapState } from 'vuex'
export default {
name: 'DeOutWidget',
props: {
@ -63,6 +64,11 @@ export default {
h: {
type: Number,
default: 50
},
editMode: {
type: String,
require: false,
default: 'edit'
}
},
data() {
@ -70,26 +76,30 @@ export default {
inputMaxSize: 46,
inputLargeSize: 42,
inputSmallSize: 38,
inputMiniSize: 34,
inputMiniSize: 32,
options: null,
showNumber: false,
mainClass: ''
mainClass: '',
mainHeight: 75,
duHeight: 46
}
},
computed: {
sizeInfo() {
let size
if (this.h > this.inputMaxSize) {
return size
} else if (this.h > this.inputLargeSize) {
if (this.duHeight > this.inputMaxSize) {
} else if (this.duHeight > this.inputLargeSize) {
size = 'medium'
} else if (this.h > this.inputSmallSize) {
} else if (this.duHeight > this.inputSmallSize) {
size = 'small'
} else {
size = 'mini'
}
return size
}
},
...mapState([
'curCanvasScale'
])
},
mounted() {
this.watchSize()
@ -102,12 +112,16 @@ export default {
watchSize() {
const erd = elementResizeDetectorMaker()
erd.listenTo(this.$refs.myContainer, ele => {
const deContentContainer = this.$refs.deContentContainer
const height = ele.offsetHeight
this.mainHeight = height
if (!this.element.options.attrs.title) {
this.duHeight = this.mainHeight
deContentContainer.style.marginLeft = '0px'
return
}
const height = ele.offsetHeight
const titleWidth = this.$refs.deTitle.offsetWidth
const deContentContainer = this.$refs.deContentContainer
this.duHeight = height - titleWidth
this.$nextTick(() => {
let min = this.element.style.fontSize * 2 + 50
if (this.element.component === 'de-number-range') {

View File

@ -67,6 +67,8 @@
</template>
<script>
import {mapState} from "vuex";
export default {
name: 'FilterControl',
props: {
@ -116,7 +118,7 @@ export default {
showTitleChange(value) {
if (!value) {
this.attrs.title = ''
// this.componentInfo.style.backgroundColor = ''
this.element.style.backgroundColor = ''
}
this.fillAttrs2Filter()
},