feat: 新增 Taro 模板双端运行与独立 Web 预览
This commit is contained in:
1 parent
f4061a24bd
commit
7e8fc01fba
48 files changed
+11576
-12
No files matched your search
@@ -0,0 +1,33 @@
|
||||
import { View, Button } from "@tarojs/components";
|
||||
import { useRouter } from "@tarojs/taro";
|
||||
import { TemplatePage } from "@template";
|
||||
import { useWorkspace } from "../runtime/workspace";
|
||||
import type { PageKey } from "../runtime/navigation";
|
||||
import { Inquiry } from "./Inquiry";
|
||||
import { Records } from "./Records";
|
||||
import { Success } from "./Success";
|
||||
export function Page({ page }: { page: PageKey }) {
|
||||
const { workspace, error, loading, reload } = useWorkspace();
|
||||
const router = useRouter();
|
||||
if (loading) return <View className="runtime-state">正在加载…</View>;
|
||||
if (error || !workspace)
|
||||
return (
|
||||
<View className="runtime-state">
|
||||
{error || "暂时无法加载"}
|
||||
<Button onClick={reload}>重试</Button>
|
||||
</View>
|
||||
);
|
||||
const children =
|
||||
page === "inquiry" ? (
|
||||
<Inquiry workspace={workspace} />
|
||||
) : page === "records" ? (
|
||||
<Records workspace={workspace} />
|
||||
) : page === "success" ? (
|
||||
<Success workspace={workspace} />
|
||||
) : null;
|
||||
return (
|
||||
<TemplatePage workspace={workspace} page={page} offeringId={router.params.id}>
|
||||
{children}
|
||||
</TemplatePage>
|
||||
);
|
||||
}
|
||||
Reference in new issue
Block a user