refactor(Tabbar): refactor with composition api

This commit is contained in:
chenjiahan
2020-08-28 15:19:16 +08:00
parent e3cf460762
commit f843e6def9
7 changed files with 117 additions and 132 deletions
+2 -9
View File
@@ -48,6 +48,7 @@ export default createComponent({
const [visible, setVisible] = useToggle();
const daysRef = ref();
const monthRef = ref();
const height = useHeight(monthRef);
const title = computed(() => formatMonthTitle(props.date));
@@ -82,14 +83,6 @@ export default createComponent({
}
});
let height;
const getHeight = () => {
if (!height) {
height = useHeight(monthRef);
}
return height;
};
const getDate = () => props.data;
const getTitle = () => title.value;
@@ -255,9 +248,9 @@ export default createComponent({
// @exposed-api
const vm = getCurrentInstance().proxy;
vm.height = height;
vm.getDate = getDate;
vm.getTitle = getTitle;
vm.getHeight = getHeight;
vm.setVisible = setVisible;
vm.scrollIntoView = scrollIntoView;