export type State = { colorIndex: number, currentColor: string } const colorList: string[] = ['#FF0000', '#00FF00', '#0000FF'] export const state = reactive({ colorIndex: 0, currentColor: colorList[0] } as State) export const setColorIndex = (index: number) => { state.colorIndex = index state.currentColor = colorList[index] }