chore(Tabbar): use relation

This commit is contained in:
chenjiahan
2020-09-26 11:13:49 +08:00
parent 11890ef3c1
commit 367a273bd5
3 changed files with 9 additions and 38 deletions
+8 -7
View File
@@ -1,7 +1,12 @@
import { ref, reactive, provide } from 'vue';
import { ref } from 'vue';
// Utils
import { createNamespace, isDef } from '../utils';
import { BORDER_TOP_BOTTOM } from '../utils/constant';
import { callInterceptor } from '../utils/interceptor';
// Composition
import { useChildren } from '../composition/use-relation';
import { usePlaceholder } from '../composition/use-placeholder';
const [createComponent, bem] = createNamespace('tabbar');
@@ -38,7 +43,7 @@ export default createComponent({
setup(props, { emit, slots }) {
const root = ref();
const children = reactive([]);
const { linkChildren } = useChildren(TABBAR_KEY);
const renderPlaceholder = usePlaceholder(root, bem);
const isUnfit = () => {
@@ -76,11 +81,7 @@ export default createComponent({
}
};
provide(TABBAR_KEY, {
props,
children,
setActive,
});
linkChildren({ props, setActive });
return () => {
if (props.fixed && props.placeholder) {