feat:新增吸附修改的全局设置

This commit is contained in:
mtruning
2022-03-05 22:11:25 +08:00
parent 00f2359b9d
commit 76b22ce05c
7 changed files with 68 additions and 20 deletions
+4 -1
View File
@@ -1,8 +1,11 @@
export type ListType = {
key: string
key: any
type: string
name: string
desc: string
value: any
suffix?: string
step?: number
min?: number
tip?: string
}
+26 -2
View File
@@ -21,6 +21,17 @@
@update:value="handleChange($event, item)"
/>
</template>
<template v-else-if="item.type === 'number'">
<n-input-number
v-model:value="item.value"
class="input-num-width"
size="small"
:step="item.step || null"
:suffix="item.suffix || null"
:min="item.min || 0"
@update:value="handleChange($event, item)"
/>
</template>
</n-space>
<n-space>
<n-text class="item-right">{{ item.desc }}</n-text>
@@ -58,6 +69,16 @@ defineProps({
const settingStore = useSettingStore()
const list = reactive<ListType[]>([
{
key: SettingStoreEnums.CHART_ALIGN_RANGE,
value: settingStore.getChartAlignRange,
type: 'number',
name: '吸附距离',
min: 10,
suffix: 'px',
step: 2,
desc: '移动图表时的吸附距离'
},
{
key: SettingStoreEnums.ASIDE_ALL_COLLAPSED,
value: settingStore.getAsideAllCollapsed,
@@ -86,18 +107,21 @@ const closeHandle = () => {
emit('update:modelShow', false)
}
const handleChange = (e: Event, item: ListType) => {
const handleChange = (e: MouseEvent, item: ListType) => {
settingStore.setItem(item.key, item.value)
}
</script>
<style lang="scss" scoped>
@include go('system-setting') {
@include go("system-setting") {
@extend .go-background-filter;
min-width: 100px;
max-width: 60vw;
.item-left {
width: 200px;
}
.input-num-width {
width: 100px;
}
}
</style>