diff --git a/src/area/index.js b/src/area/index.js
index 99608f7db..c8e6dde01 100644
--- a/src/area/index.js
+++ b/src/area/index.js
@@ -1,6 +1,6 @@
import { ref, watch, computed, reactive, nextTick, onMounted } from 'vue';
import { createNamespace, pick } from '../utils';
-import { usePublicApi } from '../composition/use-public-api';
+import { useExpose } from '../composition/use-expose';
import { pickerProps } from '../picker/shared';
import Picker from '../picker';
@@ -250,9 +250,8 @@ export default createComponent({
};
const onConfirm = (values, index) => {
- values = parseValues(values);
setValues();
- emit('confirm', values, index);
+ emit('confirm', parseValues(values), index);
};
onMounted(setValues);
@@ -274,7 +273,7 @@ export default createComponent({
}
);
- usePublicApi({ reset, getArea });
+ useExpose({ reset, getArea });
return () => {
const columns = state.columns.slice(0, +props.columnsNum);
diff --git a/src/calendar/components/Month.js b/src/calendar/components/Month.js
index bbcd2bb29..5c1e57998 100644
--- a/src/calendar/components/Month.js
+++ b/src/calendar/components/Month.js
@@ -18,7 +18,7 @@ import {
// Composition
import { useToggle } from '@vant/use';
import { useHeight } from '../../composition/use-rect';
-import { usePublicApi } from '../../composition/use-public-api';
+import { useExpose } from '../../composition/use-expose';
// Components
import Day from './Day';
@@ -251,7 +251,7 @@ export default createComponent({
return
;
};
- usePublicApi({
+ useExpose({
height,
getDate,
getTitle,
diff --git a/src/composition/use-public-api.ts b/src/composition/use-expose.ts
similarity index 70%
rename from src/composition/use-public-api.ts
rename to src/composition/use-expose.ts
index 241c25209..6cd8b431d 100644
--- a/src/composition/use-public-api.ts
+++ b/src/composition/use-expose.ts
@@ -1,7 +1,7 @@
import { getCurrentInstance } from 'vue';
// expose public api
-export function usePublicApi(apis: Record) {
+export function useExpose(apis: Record) {
const vm = (getCurrentInstance() as any).ctx;
Object.assign(vm, apis);
}
diff --git a/src/count-down/index.js b/src/count-down/index.js
index 5567ba867..708ab78f1 100644
--- a/src/count-down/index.js
+++ b/src/count-down/index.js
@@ -13,7 +13,7 @@ import { raf, cancelRaf } from '../utils/dom/raf';
import { isSameSecond, parseTimeData, parseFormat } from './utils';
// Composition
-import { usePublicApi } from '../composition/use-public-api';
+import { useExpose } from '../composition/use-expose';
const [createComponent, bem] = createNamespace('count-down');
@@ -140,7 +140,7 @@ export default createComponent({
onBeforeUnmount(pause);
- usePublicApi({
+ useExpose({
start,
reset,
pause,
diff --git a/src/datetime-picker/index.js b/src/datetime-picker/index.js
index 48ef3623a..ce10aaa80 100644
--- a/src/datetime-picker/index.js
+++ b/src/datetime-picker/index.js
@@ -1,6 +1,6 @@
import { ref } from 'vue';
import { createNamespace } from '../utils';
-import { usePublicApi } from '../composition/use-public-api';
+import { useExpose } from '../composition/use-expose';
import TimePicker from './TimePicker';
import DatePicker from './DatePicker';
@@ -15,7 +15,7 @@ export default createComponent({
setup(props) {
const root = ref();
- usePublicApi({
+ useExpose({
getPicker: () => root.value && root.value.getPicker(),
});
diff --git a/src/dropdown-item/index.js b/src/dropdown-item/index.js
index d7a796d9b..57e03ecc2 100644
--- a/src/dropdown-item/index.js
+++ b/src/dropdown-item/index.js
@@ -6,7 +6,7 @@ import { DROPDOWN_KEY } from '../dropdown-menu';
// Composition
import { useParent } from '../composition/use-relation';
-import { usePublicApi } from '../composition/use-public-api';
+import { useExpose } from '../composition/use-expose';
// Components
import Cell from '../cell';
@@ -169,7 +169,7 @@ export default createComponent({
);
};
- usePublicApi({ toggle });
+ useExpose({ toggle });
return () => {
if (props.teleport) {
diff --git a/src/image-preview/ImagePreview.js b/src/image-preview/ImagePreview.js
index b0685dc34..bab5d5b4b 100644
--- a/src/image-preview/ImagePreview.js
+++ b/src/image-preview/ImagePreview.js
@@ -6,7 +6,7 @@ import { callInterceptor } from '../utils/interceptor';
// Composition
import { useWindowSize } from '@vant/use';
-import { usePublicApi } from '../composition/use-public-api';
+import { useExpose } from '../composition/use-expose';
// Components
import Icon from '../icon';
@@ -177,7 +177,7 @@ export default createComponent({
}
};
- usePublicApi({ swipeTo });
+ useExpose({ swipeTo });
onMounted(resize);
diff --git a/src/list/index.js b/src/list/index.js
index b028c4c02..92b2dfd6a 100644
--- a/src/list/index.js
+++ b/src/list/index.js
@@ -7,7 +7,7 @@ import { isHidden } from '../utils/dom/style';
// Composition
import { useScrollParent, useEventListener } from '@vant/use';
import { useRect } from '../composition/use-rect';
-import { usePublicApi } from '../composition/use-public-api';
+import { useExpose } from '../composition/use-expose';
// Components
import Loading from '../loading';
@@ -142,7 +142,7 @@ export default createComponent({
}
});
- usePublicApi({ check });
+ useExpose({ check });
useEventListener('scroll', check, { target: scrollParent });
diff --git a/src/swipe-cell/index.js b/src/swipe-cell/index.js
index 6d269bea1..c216c96ca 100644
--- a/src/swipe-cell/index.js
+++ b/src/swipe-cell/index.js
@@ -10,7 +10,7 @@ import { callInterceptor } from '../utils/interceptor';
import { useClickAway } from '@vant/use';
import { useRect } from '../composition/use-rect';
import { useTouch } from '../composition/use-touch';
-import { usePublicApi } from '../composition/use-public-api';
+import { useExpose } from '../composition/use-expose';
const [createComponent, bem] = createNamespace('swipe-cell');
@@ -178,7 +178,7 @@ export default createComponent({
}
};
- usePublicApi({
+ useExpose({
open,
close,
});
diff --git a/src/uploader/index.js b/src/uploader/index.js
index e28cb672a..85462427a 100644
--- a/src/uploader/index.js
+++ b/src/uploader/index.js
@@ -12,7 +12,7 @@ import {
} from './utils';
// Composition
-import { usePublicApi } from '../composition/use-public-api';
+import { useExpose } from '../composition/use-expose';
import { useParentField } from '../composition/use-parent-field';
// Components
@@ -308,7 +308,7 @@ export default createComponent({
}
};
- usePublicApi({
+ useExpose({
chooseFile,
closeImagePreview,
});
diff --git a/src/utils/mount-component.ts b/src/utils/mount-component.ts
index 3ffb47ce6..724dfaf19 100644
--- a/src/utils/mount-component.ts
+++ b/src/utils/mount-component.ts
@@ -1,5 +1,5 @@
import { createApp, reactive, Component, nextTick } from 'vue';
-import { usePublicApi } from '../composition/use-public-api';
+import { useExpose } from '../composition/use-expose';
export function usePopupState() {
const state = reactive({
@@ -22,7 +22,7 @@ export function usePopupState() {
toggle(false);
};
- usePublicApi({ open, close, toggle });
+ useExpose({ open, close, toggle });
return {
open,