2021-08-12 18:59:12 +08:00
|
|
|
<!DOCTYPE html>
|
|
|
|
<html lang="en">
|
|
|
|
<head>
|
|
|
|
<meta charset="UTF-8" />
|
|
|
|
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
2021-08-16 10:34:27 +08:00
|
|
|
<title>meta-ui runtime example: nested hash router</title>
|
2021-08-12 18:59:12 +08:00
|
|
|
<script>
|
|
|
|
delete window.history;
|
|
|
|
</script>
|
|
|
|
</head>
|
|
|
|
<body>
|
|
|
|
<div id="root"></div>
|
|
|
|
<script type="module">
|
|
|
|
import renderApp from "../../src/main.tsx";
|
|
|
|
renderApp({
|
|
|
|
version: "example/v1",
|
|
|
|
metadata: {
|
|
|
|
name: "nested_hash_router",
|
|
|
|
description: "nested hash router example",
|
|
|
|
},
|
|
|
|
spec: {
|
|
|
|
components: [
|
|
|
|
{
|
|
|
|
id: "parent",
|
|
|
|
type: "core/v1/router",
|
|
|
|
properties: {
|
2021-08-24 16:20:00 +08:00
|
|
|
switchPolicy: [
|
2021-08-12 18:59:12 +08:00
|
|
|
{
|
|
|
|
type: "route",
|
|
|
|
path: "/1",
|
|
|
|
cid: "child1",
|
|
|
|
default: true,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
type: "route",
|
|
|
|
path: "/2",
|
|
|
|
cid: "child2",
|
|
|
|
default: false,
|
|
|
|
},
|
|
|
|
],
|
|
|
|
},
|
|
|
|
traits: [],
|
|
|
|
},
|
|
|
|
{
|
|
|
|
id: "child1",
|
|
|
|
type: "core/v1/router",
|
|
|
|
properties: {
|
2021-08-24 16:20:00 +08:00
|
|
|
switchPolicy: [
|
2021-08-12 18:59:12 +08:00
|
|
|
{
|
|
|
|
type: "route",
|
|
|
|
path: "/1",
|
|
|
|
cid: "grandchild1_1",
|
|
|
|
default: true,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
type: "route",
|
|
|
|
path: "/2",
|
|
|
|
cid: "grandchild1_2",
|
|
|
|
default: false,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
type: "route",
|
|
|
|
path: "/3",
|
|
|
|
cid: "grandchild1_3",
|
|
|
|
default: false,
|
|
|
|
},
|
|
|
|
],
|
|
|
|
},
|
|
|
|
traits: [
|
|
|
|
{
|
|
|
|
type: "core/v1/route",
|
|
|
|
properties: {
|
|
|
|
routerId: "parent",
|
|
|
|
},
|
|
|
|
},
|
|
|
|
],
|
|
|
|
},
|
|
|
|
{
|
|
|
|
id: "child2",
|
|
|
|
type: "core/v1/router",
|
|
|
|
properties: {
|
2021-08-24 16:20:00 +08:00
|
|
|
switchPolicy: [
|
2021-08-12 18:59:12 +08:00
|
|
|
{
|
|
|
|
type: "route",
|
|
|
|
path: "/1",
|
|
|
|
cid: "grandchild2_1",
|
|
|
|
default: true,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
type: "route",
|
|
|
|
path: "/2",
|
|
|
|
cid: "grandchild2_2",
|
|
|
|
default: false,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
type: "route",
|
|
|
|
path: "/3",
|
|
|
|
cid: "grandchild2_3",
|
|
|
|
default: false,
|
|
|
|
},
|
|
|
|
],
|
|
|
|
},
|
|
|
|
traits: [
|
|
|
|
{
|
|
|
|
type: "core/v1/route",
|
|
|
|
properties: {
|
|
|
|
routerId: "parent",
|
|
|
|
},
|
|
|
|
},
|
|
|
|
],
|
|
|
|
},
|
|
|
|
{
|
|
|
|
id: "grandchild1_1",
|
|
|
|
type: "core/v1/text",
|
|
|
|
properties: {
|
|
|
|
value: {
|
|
|
|
raw: "1_1",
|
|
|
|
format: "plain",
|
|
|
|
},
|
|
|
|
},
|
|
|
|
traits: [
|
|
|
|
{
|
|
|
|
type: "core/v1/route",
|
|
|
|
properties: {
|
|
|
|
routerId: "child1",
|
|
|
|
},
|
|
|
|
},
|
|
|
|
],
|
|
|
|
},
|
|
|
|
{
|
|
|
|
id: "grandchild1_2",
|
|
|
|
type: "core/v1/text",
|
|
|
|
properties: {
|
|
|
|
value: {
|
|
|
|
raw: "1_2",
|
|
|
|
format: "plain",
|
|
|
|
},
|
|
|
|
},
|
|
|
|
traits: [
|
|
|
|
{
|
|
|
|
type: "core/v1/route",
|
|
|
|
properties: {
|
|
|
|
routerId: "child1",
|
|
|
|
},
|
|
|
|
},
|
|
|
|
],
|
|
|
|
},
|
|
|
|
{
|
|
|
|
id: "grandchild1_3",
|
|
|
|
type: "core/v1/text",
|
|
|
|
properties: {
|
|
|
|
value: {
|
|
|
|
raw: "1_3",
|
|
|
|
format: "plain",
|
|
|
|
},
|
|
|
|
},
|
|
|
|
traits: [
|
|
|
|
{
|
|
|
|
type: "core/v1/route",
|
|
|
|
properties: {
|
|
|
|
routerId: "child1",
|
|
|
|
},
|
|
|
|
},
|
|
|
|
],
|
|
|
|
},
|
|
|
|
{
|
|
|
|
id: "grandchild2_1",
|
|
|
|
type: "core/v1/text",
|
|
|
|
properties: {
|
|
|
|
value: {
|
|
|
|
raw: "2_1",
|
|
|
|
format: "plain",
|
|
|
|
},
|
|
|
|
},
|
|
|
|
traits: [
|
|
|
|
{
|
|
|
|
type: "core/v1/route",
|
|
|
|
properties: {
|
|
|
|
routerId: "child2",
|
|
|
|
},
|
|
|
|
},
|
|
|
|
],
|
|
|
|
},
|
|
|
|
{
|
|
|
|
id: "grandchild2_2",
|
|
|
|
type: "core/v1/text",
|
|
|
|
properties: {
|
|
|
|
value: {
|
|
|
|
raw: "2_2",
|
|
|
|
format: "plain",
|
|
|
|
},
|
|
|
|
},
|
|
|
|
traits: [
|
|
|
|
{
|
|
|
|
type: "core/v1/route",
|
|
|
|
properties: {
|
|
|
|
routerId: "child2",
|
|
|
|
},
|
|
|
|
},
|
|
|
|
],
|
|
|
|
},
|
|
|
|
{
|
|
|
|
id: "grandchild2_3",
|
|
|
|
type: "core/v1/text",
|
|
|
|
properties: {
|
|
|
|
value: {
|
|
|
|
raw: "2_3",
|
|
|
|
format: "plain",
|
|
|
|
},
|
|
|
|
},
|
|
|
|
traits: [
|
|
|
|
{
|
|
|
|
type: "core/v1/route",
|
|
|
|
properties: {
|
|
|
|
routerId: "child2",
|
|
|
|
},
|
|
|
|
},
|
|
|
|
],
|
|
|
|
},
|
|
|
|
],
|
|
|
|
},
|
|
|
|
});
|
|
|
|
</script>
|
|
|
|
</body>
|
|
|
|
</html>
|