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 { createNamespace, pick } from '../utils';
|
||||||
import { pickerProps } from '../picker/shared';
|
import { pickerProps } from '../picker/shared';
|
||||||
import Picker from '../picker';
|
import Picker from '../picker';
|
||||||
@ -273,11 +281,12 @@ export default createComponent({
|
|||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
return (vm) => {
|
// @exposed-api
|
||||||
// @exposed-api
|
const vm = getCurrentInstance().proxy;
|
||||||
vm.reset = reset;
|
vm.reset = reset;
|
||||||
vm.getArea = getArea;
|
vm.getArea = getArea;
|
||||||
|
|
||||||
|
return () => {
|
||||||
const columns = state.columns.slice(0, +props.columnsNum);
|
const columns = state.columns.slice(0, +props.columnsNum);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
import { ref, computed } from 'vue';
|
import { ref, computed, getCurrentInstance } from 'vue';
|
||||||
import { createNamespace, addUnit } from '../../utils';
|
import { createNamespace, addUnit } from '../../utils';
|
||||||
import { unitToPx } from '../../utils/format/unit';
|
import { unitToPx } from '../../utils/format/unit';
|
||||||
import { setScrollTop } from '../../utils/dom/scroll';
|
import { setScrollTop } from '../../utils/dom/scroll';
|
||||||
@ -246,19 +246,19 @@ export default createComponent({
|
|||||||
return <div ref={daysRef} />;
|
return <div ref={daysRef} />;
|
||||||
};
|
};
|
||||||
|
|
||||||
return (vm) => {
|
// @exposed-api
|
||||||
vm.getDate = getDate;
|
const vm = getCurrentInstance().proxy;
|
||||||
vm.getTitle = getTitle;
|
vm.getDate = getDate;
|
||||||
vm.getHeight = getHeight;
|
vm.getTitle = getTitle;
|
||||||
vm.setVisible = setVisible;
|
vm.getHeight = getHeight;
|
||||||
vm.scrollIntoView = scrollIntoView;
|
vm.setVisible = setVisible;
|
||||||
|
vm.scrollIntoView = scrollIntoView;
|
||||||
|
|
||||||
return (
|
return () => (
|
||||||
<div class={bem('month')} ref={monthRef} style={monthStyle.value}>
|
<div class={bem('month')} ref={monthRef} style={monthStyle.value}>
|
||||||
{renderTitle()}
|
{renderTitle()}
|
||||||
{renderDays()}
|
{renderDays()}
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
};
|
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
@ -5,6 +5,7 @@ import {
|
|||||||
onActivated,
|
onActivated,
|
||||||
onDeactivated,
|
onDeactivated,
|
||||||
onBeforeUnmount,
|
onBeforeUnmount,
|
||||||
|
getCurrentInstance,
|
||||||
} from 'vue';
|
} from 'vue';
|
||||||
import { createNamespace } from '../utils';
|
import { createNamespace } from '../utils';
|
||||||
import { raf, cancelRaf } from '../utils/dom/raf';
|
import { raf, cancelRaf } from '../utils/dom/raf';
|
||||||
@ -135,17 +136,16 @@ export default createComponent({
|
|||||||
|
|
||||||
onBeforeUnmount(pause);
|
onBeforeUnmount(pause);
|
||||||
|
|
||||||
return (vm) => {
|
// @exposed-api
|
||||||
// @exposed-api
|
const vm = getCurrentInstance().proxy;
|
||||||
vm.start = start;
|
vm.start = start;
|
||||||
vm.reset = reset;
|
vm.reset = reset;
|
||||||
vm.pause = pause;
|
vm.pause = pause;
|
||||||
|
|
||||||
return (
|
return () => (
|
||||||
<div class={bem()}>
|
<div class={bem()}>
|
||||||
{slots.default ? slots.default(timeData.value) : timeText.value}
|
{slots.default ? slots.default(timeData.value) : timeText.value}
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
};
|
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
Loading…
x
Reference in New Issue
Block a user