vben
2020-10-20 968f791f4b7112730813c8c990379051c3f8340d
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
import { Ref, ref, watch, unref } from 'vue';
import { BasicTableProps } from '../types/table';
 
/**
 * @description:
 * @Date: 2020-05-12 13:20:37
 */
export function useProps(props: Readonly<Ref<BasicTableProps>>) {
  const propsRef = (ref<BasicTableProps>(unref(props)) as unknown) as Ref<BasicTableProps>;
  watch(
    () => props.value,
    (v) => {
      propsRef.value = unref(v);
    },
    {
      immediate: false,
    }
  );
  return { propsRef };
}