forked from github/dataease
refactor(组件): 组件位置调整限制左侧最大值
This commit is contained in:
parent
834aacbc19
commit
8e44c5f02c
@ -29,6 +29,8 @@
|
||||
v-model="styleInfo.left"
|
||||
type="number"
|
||||
:min="0"
|
||||
:max="maxLeft"
|
||||
@change="leftOnChange"
|
||||
class="hide-icon-number"
|
||||
>
|
||||
<template slot="append">px</template>
|
||||
@ -69,6 +71,8 @@
|
||||
|
||||
<script>
|
||||
|
||||
import { mapState } from 'vuex'
|
||||
|
||||
export default {
|
||||
name: 'PositionAdjust',
|
||||
props: {},
|
||||
@ -76,14 +80,26 @@ export default {
|
||||
return {}
|
||||
},
|
||||
computed: {
|
||||
maxLeft() {
|
||||
return 1600 - this.styleInfo.width - this.componentGap
|
||||
},
|
||||
styleInfo() {
|
||||
return this.$store.state.curComponent.style
|
||||
}
|
||||
},
|
||||
...mapState([
|
||||
'componentGap'
|
||||
])
|
||||
},
|
||||
watch: {},
|
||||
mounted() {
|
||||
},
|
||||
methods: {}
|
||||
methods: {
|
||||
leftOnChange() {
|
||||
if (this.styleInfo.left > this.maxLeft) {
|
||||
this.styleInfo.left = this.maxLeft
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user