mirror of
https://gitcode.com/gh_mirrors/hy/Hydro.git
synced 2026-10-20 01:38:19 +08:00
ui-next: add sample plugin
This commit is contained in:
4 files changed
+17
-10
No files matched your search
@@ -0,0 +1,6 @@
|
|||||||
|
{
|
||||||
|
"name": "@hydrooj/ui-next-plugin-sample",
|
||||||
|
"dependencies": {
|
||||||
|
"@hydrooj/ui-next": "workspace:*"
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,4 @@
|
|||||||
|
export default function BeforeComponent() {
|
||||||
|
console.log('before app');
|
||||||
|
return <div>before app via @hydrooj/ui-next-plugin-sample</div>;
|
||||||
|
}
|
||||||
@@ -0,0 +1,6 @@
|
|||||||
|
import type { PluginAPI } from '@hydrooj/ui-next';
|
||||||
|
import BeforeComponent from './before';
|
||||||
|
|
||||||
|
export function setup(api: PluginAPI) {
|
||||||
|
api.before('page:app', BeforeComponent);
|
||||||
|
}
|
||||||
@@ -1,6 +1,6 @@
|
|||||||
import { Link } from './components/link';
|
import { Link } from './components/link';
|
||||||
import { usePageData } from './context/page-data';
|
import { usePageData } from './context/page-data';
|
||||||
import { before, defineSlot } from './registry';
|
import { defineSlot } from './registry';
|
||||||
|
|
||||||
const AppInner = defineSlot('page:app', () => {
|
const AppInner = defineSlot('page:app', () => {
|
||||||
const data = usePageData();
|
const data = usePageData();
|
||||||
@@ -15,13 +15,4 @@ const AppInner = defineSlot('page:app', () => {
|
|||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
before('page:app', () => {
|
|
||||||
console.log('before app');
|
|
||||||
return (
|
|
||||||
<>
|
|
||||||
<div>before app</div>
|
|
||||||
</>
|
|
||||||
);
|
|
||||||
});
|
|
||||||
|
|
||||||
export default AppInner;
|
export default AppInner;
|
||||||
Reference in new issue
Block a user