-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcontext.ts
More file actions
43 lines (39 loc) · 831 Bytes
/
context.ts
File metadata and controls
43 lines (39 loc) · 831 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
import React from "react"
type StepsFormContextType = {
/**
* 全局的表单的值
*/
values: any
/**
* 当前的步骤 从 0 开始
*/
currentIndex: number
/**
* 子组件的数量
*/
childrenCount?: number
/**
* 设置当前的步骤
* @param index
* @returns
*/
setCurrentIndex?: (index: number) => void
/**
* 最终全部表单的提交
* @param value 全部表单的值
* @returns
*/
onLastFinish?: (value: any) => Promise<boolean | void>
/**
* 设置表单的值
* @param values
* @returns
*/
setValues?: (values: any) => void
}
const StepsFormContext = React.createContext<StepsFormContextType>({
values: undefined,
currentIndex: 0,
})
export const { Provider: StepsFormProvider } = StepsFormContext
export default StepsFormContext