mirror of
https://github.com/pipipi-pikachu/PPTist.git
synced 2025-04-15 02:20:00 +08:00
perf: 图表预置主题配色可选长度
This commit is contained in:
parent
96c38e1e54
commit
997bb47cea
@ -100,8 +100,17 @@
|
|||||||
<Popover trigger="click" v-model:visible="presetThemesVisible">
|
<Popover trigger="click" v-model:visible="presetThemesVisible">
|
||||||
<template #content>
|
<template #content>
|
||||||
<div class="preset-themes">
|
<div class="preset-themes">
|
||||||
<div class="preset-theme" v-for="(item, index) in presetChartThemes" :key="index" @click="applyPresetTheme(item)">
|
<div class="preset-theme" v-for="(item, index) in presetChartThemes" :key="index">
|
||||||
<div class="preset-theme-color" v-for="color in item" :key="color" :style="{ backgroundColor: color }"></div>
|
<div
|
||||||
|
class="preset-theme-color"
|
||||||
|
:class="{ 'select': presetThemeColorHoverIndex[0] === index && itemIndex <= presetThemeColorHoverIndex[1] }"
|
||||||
|
v-for="(color, itemIndex) in item"
|
||||||
|
:key="color"
|
||||||
|
:style="{ backgroundColor: color }"
|
||||||
|
@click="applyPresetTheme(item, itemIndex)"
|
||||||
|
@mouseenter="presetThemeColorHoverIndex = [index, itemIndex]"
|
||||||
|
@mouseleave="presetThemeColorHoverIndex = [-1, -1]"
|
||||||
|
></div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
@ -181,6 +190,7 @@ export default defineComponent({
|
|||||||
|
|
||||||
const chartDataEditorVisible = ref(false)
|
const chartDataEditorVisible = ref(false)
|
||||||
const presetThemesVisible = ref(false)
|
const presetThemesVisible = ref(false)
|
||||||
|
const presetThemeColorHoverIndex = ref<[number, number]>([-1, -1])
|
||||||
|
|
||||||
const { addHistorySnapshot } = useHistorySnapshot()
|
const { addHistorySnapshot } = useHistorySnapshot()
|
||||||
|
|
||||||
@ -262,8 +272,9 @@ export default defineComponent({
|
|||||||
}
|
}
|
||||||
|
|
||||||
// 使用预置主题配色
|
// 使用预置主题配色
|
||||||
const applyPresetTheme = (colors: string[]) => {
|
const applyPresetTheme = (colors: string[], index: number) => {
|
||||||
updateElement({ themeColor: colors })
|
const themeColor = colors.slice(0, index + 1)
|
||||||
|
updateElement({ themeColor })
|
||||||
presetThemesVisible.value = false
|
presetThemesVisible.value = false
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -295,6 +306,7 @@ export default defineComponent({
|
|||||||
return {
|
return {
|
||||||
chartDataEditorVisible,
|
chartDataEditorVisible,
|
||||||
presetThemesVisible,
|
presetThemesVisible,
|
||||||
|
presetThemeColorHoverIndex,
|
||||||
handleElement,
|
handleElement,
|
||||||
updateData,
|
updateData,
|
||||||
fill,
|
fill,
|
||||||
@ -364,5 +376,10 @@ export default defineComponent({
|
|||||||
.preset-theme-color {
|
.preset-theme-color {
|
||||||
width: 20px;
|
width: 20px;
|
||||||
height: 20px;
|
height: 20px;
|
||||||
|
|
||||||
|
&.select {
|
||||||
|
transform: scale(1.2);
|
||||||
|
transition: transform $transitionDelayFast;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
Loading…
x
Reference in New Issue
Block a user