Merge pull request #3852 from dataease/pr@dev@fix_tab-position-adjust

refactor(组件): 组件位置调整限制左侧最大值
This commit is contained in:
Junjun 2022-11-24 16:41:29 +08:00 committed by GitHub
commit b931e05b5e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -29,6 +29,8 @@
v-model="styleInfo.left" v-model="styleInfo.left"
type="number" type="number"
:min="0" :min="0"
:max="maxLeft"
@change="leftOnChange"
class="hide-icon-number" class="hide-icon-number"
> >
<template slot="append">px</template> <template slot="append">px</template>
@ -69,6 +71,8 @@
<script> <script>
import { mapState } from 'vuex'
export default { export default {
name: 'PositionAdjust', name: 'PositionAdjust',
props: {}, props: {},
@ -76,14 +80,26 @@ export default {
return {} return {}
}, },
computed: { computed: {
maxLeft() {
return 1600 - this.styleInfo.width - this.componentGap
},
styleInfo() { styleInfo() {
return this.$store.state.curComponent.style return this.$store.state.curComponent.style
} },
...mapState([
'componentGap'
])
}, },
watch: {}, watch: {},
mounted() { mounted() {
}, },
methods: {} methods: {
leftOnChange() {
if (this.styleInfo.left > this.maxLeft) {
this.styleInfo.left = this.maxLeft
}
}
}
} }
</script> </script>