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.

21 lines
506 B

import { watch } from "vue-demi";
import { toPoint } from "../../utils";
import { Props } from "./";
export function useWatch({ props, instance }: { props: Props; instance: T.Control }) {
watch(
() => props.position,
val => val && instance.setPosition(val)
);
watch(
() => props.offset,
val => val && instance.setOffset(toPoint(val)),
{ immediate: true }
);
watch(
() => props.visible,
val => (val ? instance.show() : instance.hide()),
{ immediate: true }
);
}