chore(IndexBar): use relation

This commit is contained in:
chenjiahan
2020-09-26 10:53:24 +08:00
parent da6925aee9
commit e4b7952061
2 changed files with 19 additions and 20 deletions
+8 -8
View File
@@ -7,7 +7,8 @@ import { INDEX_BAR_KEY } from '../index-bar';
// Composition
import { useHeight } from '../composition/use-rect';
import { useParent } from '../composition/use-parent';
import { useExpose } from '../composition/use-expose';
import { useParent } from '../composition/use-relation';
const [createComponent, bem] = createNamespace('index-anchor');
@@ -26,13 +27,7 @@ export default createComponent({
const root = ref();
const height = useHeight(root);
const { parent } = useParent(INDEX_BAR_KEY, {
props,
state,
height,
root,
});
const { parent } = useParent(INDEX_BAR_KEY);
const isSticky = () => state.active && parent.props.sticky;
@@ -50,6 +45,11 @@ export default createComponent({
}
});
useExpose({
state,
height,
});
return () => {
const sticky = isSticky();