feat: add usePublicApi

This commit is contained in:
chenjiahan
2020-08-31 16:57:49 +08:00
parent e1ac3f9a58
commit 0d64cf1b63
5 changed files with 32 additions and 39 deletions
+3 -12
View File
@@ -1,11 +1,4 @@
import {
ref,
watch,
nextTick,
onUpdated,
onMounted,
getCurrentInstance,
} from 'vue';
import { ref, watch, nextTick, onUpdated, onMounted } from 'vue';
// Utils
import { createNamespace } from '../utils';
@@ -14,6 +7,7 @@ import { isHidden } from '../utils/dom/style';
// Composition
import { useRect } from '../composition/use-rect';
import { useScroller } from '../composition/use-scroller';
import { usePublicApi } from '../composition/use-public-api';
import { useGlobalEvent } from '../composition/use-global-event';
// Components
@@ -147,12 +141,9 @@ export default createComponent({
}
});
usePublicApi({ check });
useGlobalEvent(scroller, 'scroll', check);
// @exposed-api
const vm = getCurrentInstance().proxy;
vm.check = check;
return () => {
const Content = slots.default?.();
const Placeholder = (