vuecssuiant-designantdreactantantd-vueenterprisefrontendui-designvue-antdvue-antd-uivue3vuecomponent
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
25 lines
675 B
25 lines
675 B
import { computed, inject, provide } from 'vue'; |
|
import type { Ref, InjectionKey, ComputedRef } from 'vue'; |
|
|
|
export interface RowContext { |
|
gutter: ComputedRef<[number, number]>; |
|
wrap: ComputedRef<boolean>; |
|
supportFlexGap: Ref<boolean>; |
|
} |
|
|
|
export const RowContextKey: InjectionKey<RowContext> = Symbol('rowContextKey'); |
|
|
|
const useProvideRow = (state: RowContext) => { |
|
provide(RowContextKey, state); |
|
}; |
|
|
|
const useInjectRow = () => { |
|
return inject(RowContextKey, { |
|
gutter: computed(() => undefined), |
|
wrap: computed(() => undefined), |
|
supportFlexGap: computed(() => undefined), |
|
}); |
|
}; |
|
|
|
export { useInjectRow, useProvideRow }; |
|
export default useProvideRow;
|
|
|