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"
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>