mirror of
https://gitee.com/vant-contrib/vant.git
synced 2025-04-06 03:57:59 +08:00
chore: improve exposed api
This commit is contained in:
parent
762aed3e5d
commit
d0848544d4
@ -1,4 +1,12 @@
|
||||
import { ref, watch, computed, reactive, nextTick, onMounted } from 'vue';
|
||||
import {
|
||||
ref,
|
||||
watch,
|
||||
computed,
|
||||
reactive,
|
||||
nextTick,
|
||||
onMounted,
|
||||
getCurrentInstance,
|
||||
} from 'vue';
|
||||
import { createNamespace, pick } from '../utils';
|
||||
import { pickerProps } from '../picker/shared';
|
||||
import Picker from '../picker';
|
||||
@ -273,11 +281,12 @@ export default createComponent({
|
||||
}
|
||||
);
|
||||
|
||||
return (vm) => {
|
||||
// @exposed-api
|
||||
vm.reset = reset;
|
||||
vm.getArea = getArea;
|
||||
// @exposed-api
|
||||
const vm = getCurrentInstance().proxy;
|
||||
vm.reset = reset;
|
||||
vm.getArea = getArea;
|
||||
|
||||
return () => {
|
||||
const columns = state.columns.slice(0, +props.columnsNum);
|
||||
|
||||
return (
|
||||
|
@ -1,4 +1,4 @@
|
||||
import { ref, computed } from 'vue';
|
||||
import { ref, computed, getCurrentInstance } from 'vue';
|
||||
import { createNamespace, addUnit } from '../../utils';
|
||||
import { unitToPx } from '../../utils/format/unit';
|
||||
import { setScrollTop } from '../../utils/dom/scroll';
|
||||
@ -246,19 +246,19 @@ export default createComponent({
|
||||
return <div ref={daysRef} />;
|
||||
};
|
||||
|
||||
return (vm) => {
|
||||
vm.getDate = getDate;
|
||||
vm.getTitle = getTitle;
|
||||
vm.getHeight = getHeight;
|
||||
vm.setVisible = setVisible;
|
||||
vm.scrollIntoView = scrollIntoView;
|
||||
// @exposed-api
|
||||
const vm = getCurrentInstance().proxy;
|
||||
vm.getDate = getDate;
|
||||
vm.getTitle = getTitle;
|
||||
vm.getHeight = getHeight;
|
||||
vm.setVisible = setVisible;
|
||||
vm.scrollIntoView = scrollIntoView;
|
||||
|
||||
return (
|
||||
<div class={bem('month')} ref={monthRef} style={monthStyle.value}>
|
||||
{renderTitle()}
|
||||
{renderDays()}
|
||||
</div>
|
||||
);
|
||||
};
|
||||
return () => (
|
||||
<div class={bem('month')} ref={monthRef} style={monthStyle.value}>
|
||||
{renderTitle()}
|
||||
{renderDays()}
|
||||
</div>
|
||||
);
|
||||
},
|
||||
});
|
||||
|
@ -5,6 +5,7 @@ import {
|
||||
onActivated,
|
||||
onDeactivated,
|
||||
onBeforeUnmount,
|
||||
getCurrentInstance,
|
||||
} from 'vue';
|
||||
import { createNamespace } from '../utils';
|
||||
import { raf, cancelRaf } from '../utils/dom/raf';
|
||||
@ -135,17 +136,16 @@ export default createComponent({
|
||||
|
||||
onBeforeUnmount(pause);
|
||||
|
||||
return (vm) => {
|
||||
// @exposed-api
|
||||
vm.start = start;
|
||||
vm.reset = reset;
|
||||
vm.pause = pause;
|
||||
// @exposed-api
|
||||
const vm = getCurrentInstance().proxy;
|
||||
vm.start = start;
|
||||
vm.reset = reset;
|
||||
vm.pause = pause;
|
||||
|
||||
return (
|
||||
<div class={bem()}>
|
||||
{slots.default ? slots.default(timeData.value) : timeText.value}
|
||||
</div>
|
||||
);
|
||||
};
|
||||
return () => (
|
||||
<div class={bem()}>
|
||||
{slots.default ? slots.default(timeData.value) : timeText.value}
|
||||
</div>
|
||||
);
|
||||
},
|
||||
});
|
||||
|
Loading…
x
Reference in New Issue
Block a user