Add Partials (#1824)
This commit is contained in:
@@ -0,0 +1,20 @@
|
||||
import { Partial } from "$fresh/runtime.ts";
|
||||
|
||||
export default function SlotDemo() {
|
||||
return (
|
||||
<div>
|
||||
<div class="output">
|
||||
<Partial name="slot-1">
|
||||
<p>Default content</p>
|
||||
</Partial>
|
||||
</div>
|
||||
<a
|
||||
class="update-link"
|
||||
href="/no_islands/injected"
|
||||
fh-partial="/no_islands/update"
|
||||
>
|
||||
update
|
||||
</a>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
import { defineRoute } from "$fresh/src/server/defines.ts";
|
||||
|
||||
export default defineRoute(() => {
|
||||
return new Response("", {
|
||||
status: 302,
|
||||
headers: {
|
||||
Location: "/no_islands",
|
||||
},
|
||||
});
|
||||
});
|
||||
@@ -0,0 +1,16 @@
|
||||
import { defineRoute } from "$fresh/src/server/defines.ts";
|
||||
import { RouteConfig } from "$fresh/server.ts";
|
||||
import { Partial } from "$fresh/runtime.ts";
|
||||
|
||||
export const config: RouteConfig = {
|
||||
skipAppWrapper: true,
|
||||
skipInheritedLayouts: true,
|
||||
};
|
||||
|
||||
export default defineRoute((req, ctx) => {
|
||||
return (
|
||||
<Partial name="slot-1">
|
||||
<p class="status">it works</p>
|
||||
</Partial>
|
||||
);
|
||||
});
|
||||
Reference in New Issue
Block a user