forked from github/dataease
Merge pull request #3957 from dataease/pr@dev@fix_position-adjust
refactor(视图): 视图精确位置调整限值设置
This commit is contained in:
commit
57570d1742
@ -14,7 +14,9 @@
|
|||||||
v-model="styleInfo.top"
|
v-model="styleInfo.top"
|
||||||
type="number"
|
type="number"
|
||||||
:min="0"
|
:min="0"
|
||||||
|
:max="maxTop"
|
||||||
class="hide-icon-number"
|
class="hide-icon-number"
|
||||||
|
@change="topOnChange"
|
||||||
>
|
>
|
||||||
<template slot="append">px</template>
|
<template slot="append">px</template>
|
||||||
</el-input>
|
</el-input>
|
||||||
@ -44,8 +46,11 @@
|
|||||||
>
|
>
|
||||||
<el-input
|
<el-input
|
||||||
v-model="styleInfo.width"
|
v-model="styleInfo.width"
|
||||||
|
:min="0"
|
||||||
|
:max="maxWidth"
|
||||||
type="number"
|
type="number"
|
||||||
class="hide-icon-number"
|
class="hide-icon-number"
|
||||||
|
@change="widthOnChange"
|
||||||
>
|
>
|
||||||
<template slot="append">px</template>
|
<template slot="append">px</template>
|
||||||
</el-input>
|
</el-input>
|
||||||
@ -59,7 +64,10 @@
|
|||||||
<el-input
|
<el-input
|
||||||
v-model="styleInfo.height"
|
v-model="styleInfo.height"
|
||||||
type="number"
|
type="number"
|
||||||
|
:min="0"
|
||||||
|
:max="maxHeight"
|
||||||
class="hide-icon-number"
|
class="hide-icon-number"
|
||||||
|
@change="heightOnChange"
|
||||||
>
|
>
|
||||||
<template slot="append">px</template>
|
<template slot="append">px</template>
|
||||||
</el-input>
|
</el-input>
|
||||||
@ -77,12 +85,18 @@ export default {
|
|||||||
name: 'PositionAdjust',
|
name: 'PositionAdjust',
|
||||||
props: {},
|
props: {},
|
||||||
data() {
|
data() {
|
||||||
return {}
|
return {
|
||||||
|
maxHeight: 2000,
|
||||||
|
maxTop: 40000
|
||||||
|
}
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
maxLeft() {
|
maxLeft() {
|
||||||
return 1600 - this.styleInfo.width - this.componentGap
|
return 1600 - this.styleInfo.width - this.componentGap
|
||||||
},
|
},
|
||||||
|
maxWidth() {
|
||||||
|
return 1600 - this.styleInfo.left - this.componentGap
|
||||||
|
},
|
||||||
styleInfo() {
|
styleInfo() {
|
||||||
return this.$store.state.curComponent.style
|
return this.$store.state.curComponent.style
|
||||||
},
|
},
|
||||||
@ -97,7 +111,34 @@ export default {
|
|||||||
leftOnChange() {
|
leftOnChange() {
|
||||||
if (this.styleInfo.left > this.maxLeft) {
|
if (this.styleInfo.left > this.maxLeft) {
|
||||||
this.styleInfo.left = this.maxLeft
|
this.styleInfo.left = this.maxLeft
|
||||||
|
} else if (this.styleInfo.left < 0) {
|
||||||
|
this.styleInfo.left = 0
|
||||||
}
|
}
|
||||||
|
this.$store.commit('canvasChange')
|
||||||
|
},
|
||||||
|
widthOnChange() {
|
||||||
|
if (this.styleInfo.width > this.maxWidth) {
|
||||||
|
this.styleInfo.width = this.maxWidth
|
||||||
|
} else if (this.styleInfo.width < 0) {
|
||||||
|
this.styleInfo.left = 0
|
||||||
|
}
|
||||||
|
this.$store.commit('canvasChange')
|
||||||
|
},
|
||||||
|
heightOnChange() {
|
||||||
|
if (this.styleInfo.height > this.maxHeight) {
|
||||||
|
this.styleInfo.height = this.maxHeight
|
||||||
|
} else if (this.styleInfo.height < 0) {
|
||||||
|
this.styleInfo.height = 0
|
||||||
|
}
|
||||||
|
this.$store.commit('canvasChange')
|
||||||
|
},
|
||||||
|
topOnChange() {
|
||||||
|
if (this.styleInfo.top > this.maxTop) {
|
||||||
|
this.styleInfo.top = this.maxTop
|
||||||
|
} else if (this.styleInfo.top < 0) {
|
||||||
|
this.styleInfo.top = 0
|
||||||
|
}
|
||||||
|
this.$store.commit('canvasChange')
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user