mirror of
https://gitee.com/dromara/go-view.git
synced 2025-02-25 00:33:00 +08:00
perf: 优化自定义颜色交互
This commit is contained in:
parent
8b6c616a15
commit
97899f275a
@ -183,6 +183,7 @@ const createColor = () => {
|
|||||||
colorList.push(newData)
|
colorList.push(newData)
|
||||||
selectHandle(newData)
|
selectHandle(newData)
|
||||||
updateColor.value = newData
|
updateColor.value = newData
|
||||||
|
saveHandle(false)
|
||||||
}
|
}
|
||||||
if (updateColor.value !== undefined) {
|
if (updateColor.value !== undefined) {
|
||||||
goDialog({
|
goDialog({
|
||||||
@ -235,11 +236,11 @@ const updateColorHandle = (newColor: ColorType) => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// 保存数据
|
// 保存数据
|
||||||
const saveHandle = () => {
|
const saveHandle = (onMessage = true) => {
|
||||||
if (!updateColor.value) return
|
if (!updateColor.value) return
|
||||||
const index = colorList.findIndex(item => item.id === updateColor.value?.id)
|
const index = colorList.findIndex(item => item.id === updateColor.value?.id)
|
||||||
if (index !== -1) {
|
if (index !== -1) {
|
||||||
window.$message.success('颜色应用成功!')
|
onMessage && window.$message.success('数据应用成功!')
|
||||||
const updateColorPrefix = cloneDeep({ ...updateColor.value, name: updateColor.value.name || '未定义' })
|
const updateColorPrefix = cloneDeep({ ...updateColor.value, name: updateColor.value.name || '未定义' })
|
||||||
colorList.splice(index, 1, updateColorPrefix)
|
colorList.splice(index, 1, updateColorPrefix)
|
||||||
updateColor.value = undefined
|
updateColor.value = undefined
|
||||||
@ -252,7 +253,7 @@ const saveHandle = () => {
|
|||||||
chartEditStore.setEditCanvasConfig(EditCanvasConfigEnum.CHART_THEME_COLOR, selectTheme)
|
chartEditStore.setEditCanvasConfig(EditCanvasConfigEnum.CHART_THEME_COLOR, selectTheme)
|
||||||
})
|
})
|
||||||
} else {
|
} else {
|
||||||
window.$message.error('颜色应用失败!')
|
window.$message.error('数据应用失败!')
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user