Skip to content

Commit

Permalink
feat(components): add affix-target component
Browse files Browse the repository at this point in the history
  • Loading branch information
chizukicn committed Jan 7, 2024
1 parent d0f2cc1 commit c7dff4e
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 4 deletions.
9 changes: 5 additions & 4 deletions .eslintrc
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
{
"extends": ["@curev"],
"rules": {
"unicorn/prefer-spread":"off"
}
"extends": ["@curev"],
"rules": {
"unicorn/prefer-spread": "off",
"import/export": "off"
}
}
1 change: 1 addition & 0 deletions packages/components/components.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
export * from "../core/src/affix/component";
export * from "../core/src/affix-target/component";
export * from "../core/src/selection/component";
export * from "../core/src/item/component";
export * from "../core/src/icon/component";
Expand Down
14 changes: 14 additions & 0 deletions packages/core/src/affix-target/component.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
import { defineComponent, h, ref, renderSlot } from "vue";
import { provideAffixTarget } from "../affix";

export const HiAffixTarget = defineComponent({
name: "HiAffixTarget",
setup(_, context) {
const targetRef = ref<HTMLElement | null>(null);
provideAffixTarget(targetRef);
return () => h("div", {
ref: targetRef,
...context.attrs
}, renderSlot(context.slots, "default"));
}
});
1 change: 1 addition & 0 deletions packages/hoci/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export * from "./src/index";

0 comments on commit c7dff4e

Please sign in to comment.