index.uts 466 字节
Newer Older
Y
init  
yurj26 已提交
1
export type State = {
DCloud-WZF's avatar
DCloud-WZF 已提交
2 3 4
  colorIndex: number,
  currentColor: string,
  lifeCycleNum: number
Y
init  
yurj26 已提交
5 6 7 8 9
}

const colorList: string[] = ['#FF0000', '#00FF00', '#0000FF']

export const state = reactive({
DCloud-WZF's avatar
DCloud-WZF 已提交
10 11 12
  colorIndex: 0,
  currentColor: colorList[0],
  lifeCycleNum: 0
Y
init  
yurj26 已提交
13 14 15 16 17 18
} as State)

export const setColorIndex = (index: number) => {
  state.colorIndex = index
  state.currentColor = colorList[index]
}
DCloud-WZF's avatar
DCloud-WZF 已提交
19 20 21 22

export const setLifeCycleNum = (num: number) => {
  state.lifeCycleNum = num
}