Add Partials (#1824)
This commit is contained in:
@@ -0,0 +1,25 @@
|
||||
import { Partial } from "$fresh/runtime.ts";
|
||||
import CounterA from "../../islands/CounterA.tsx";
|
||||
import { Fader } from "../../islands/Fader.tsx";
|
||||
|
||||
export default function WarnDemo() {
|
||||
return (
|
||||
<div>
|
||||
<Partial name="slot-1">
|
||||
<Fader>
|
||||
<p class="status-initial">Initial content</p>
|
||||
<CounterA />
|
||||
</Fader>
|
||||
</Partial>
|
||||
<p>
|
||||
<a
|
||||
class="update-link"
|
||||
href="/missing_partial/injected"
|
||||
fh-partial="/missing_partial/update"
|
||||
>
|
||||
update
|
||||
</a>
|
||||
</p>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
import { defineRoute } from "$fresh/src/server/defines.ts";
|
||||
|
||||
export default defineRoute(() => {
|
||||
return new Response("", {
|
||||
status: 302,
|
||||
headers: {
|
||||
Location: "/missing_partial",
|
||||
},
|
||||
});
|
||||
});
|
||||
@@ -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="unknown-name">
|
||||
<p class="status-append">append content</p>
|
||||
</Partial>
|
||||
);
|
||||
});
|
||||
Reference in New Issue
Block a user