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">
|
2021-08-31 11:17:19 +08:00
|
|
|
import renderApp from '../../src/main.tsx';
|
2021-08-12 18:59:12 +08:00
|
|
|
renderApp({
|
2021-08-31 11:17:19 +08:00
|
|
|
version: 'example/v1',
|
2021-08-12 18:59:12 +08:00
|
|
|
metadata: {
|
2021-08-31 11:17:19 +08:00
|
|
|
name: 'nested_hash_router',
|
|
|
|
description: 'nested hash router example',
|
2021-08-12 18:59:12 +08:00
|
|
|
},
|
|
|
|
spec: {
|
|
|
|
components: [
|
|
|
|
{
|
2021-08-31 11:17:19 +08:00
|
|
|
id: 'parent',
|
|
|
|
type: 'core/v1/router',
|
2021-08-12 18:59:12 +08:00
|
|
|
properties: {
|
2021-08-24 16:20:00 +08:00
|
|
|
switchPolicy: [
|
2021-08-12 18:59:12 +08:00
|
|
|
{
|
2021-08-31 11:17:19 +08:00
|
|
|
type: 'route',
|
|
|
|
path: '/1',
|
|
|
|
slotId: 'child1',
|
2021-08-12 18:59:12 +08:00
|
|
|
default: true,
|
|
|
|
},
|
|
|
|
{
|
2021-08-31 11:17:19 +08:00
|
|
|
type: 'route',
|
|
|
|
path: '/2',
|
|
|
|
slotId: 'child2',
|
2021-08-12 18:59:12 +08:00
|
|
|
default: false,
|
|
|
|
},
|
|
|
|
],
|
|
|
|
},
|
|
|
|
traits: [],
|
|
|
|
},
|
|
|
|
{
|
2021-08-31 11:17:19 +08:00
|
|
|
id: 'child1',
|
|
|
|
type: 'core/v1/router',
|
2021-08-12 18:59:12 +08:00
|
|
|
properties: {
|
2021-08-24 16:20:00 +08:00
|
|
|
switchPolicy: [
|
2021-08-12 18:59:12 +08:00
|
|
|
{
|
2021-08-31 11:17:19 +08:00
|
|
|
type: 'route',
|
|
|
|
path: '/1',
|
|
|
|
slotId: 'grandchild1_1',
|
2021-08-12 18:59:12 +08:00
|
|
|
default: true,
|
|
|
|
},
|
|
|
|
{
|
2021-08-31 11:17:19 +08:00
|
|
|
type: 'route',
|
|
|
|
path: '/2',
|
|
|
|
slotId: 'grandchild1_2',
|
2021-08-12 18:59:12 +08:00
|
|
|
default: false,
|
|
|
|
},
|
|
|
|
{
|
2021-08-31 11:17:19 +08:00
|
|
|
type: 'route',
|
|
|
|
path: '/3',
|
|
|
|
slotId: 'grandchild1_3',
|
2021-08-12 18:59:12 +08:00
|
|
|
default: false,
|
|
|
|
},
|
|
|
|
],
|
|
|
|
},
|
|
|
|
traits: [
|
|
|
|
{
|
2021-08-31 11:17:19 +08:00
|
|
|
type: 'core/v1/slot',
|
2021-08-12 18:59:12 +08:00
|
|
|
properties: {
|
2021-08-25 10:57:19 +08:00
|
|
|
container: {
|
2021-08-31 11:17:19 +08:00
|
|
|
id: 'parent',
|
|
|
|
slot: 'child1',
|
2021-08-25 10:57:19 +08:00
|
|
|
},
|
2021-08-12 18:59:12 +08:00
|
|
|
},
|
|
|
|
},
|
|
|
|
],
|
|
|
|
},
|
|
|
|
{
|
2021-08-31 11:17:19 +08:00
|
|
|
id: 'child2',
|
|
|
|
type: 'core/v1/router',
|
2021-08-12 18:59:12 +08:00
|
|
|
properties: {
|
2021-08-24 16:20:00 +08:00
|
|
|
switchPolicy: [
|
2021-08-12 18:59:12 +08:00
|
|
|
{
|
2021-08-31 11:17:19 +08:00
|
|
|
type: 'route',
|
|
|
|
path: '/1',
|
|
|
|
slotId: 'grandchild2_1',
|
2021-08-12 18:59:12 +08:00
|
|
|
default: true,
|
|
|
|
},
|
|
|
|
{
|
2021-08-31 11:17:19 +08:00
|
|
|
type: 'route',
|
|
|
|
path: '/2',
|
|
|
|
slotId: 'grandchild2_2',
|
2021-08-12 18:59:12 +08:00
|
|
|
default: false,
|
|
|
|
},
|
|
|
|
{
|
2021-08-31 11:17:19 +08:00
|
|
|
type: 'route',
|
|
|
|
path: '/3',
|
|
|
|
slotId: 'grandchild2_3',
|
2021-08-12 18:59:12 +08:00
|
|
|
default: false,
|
|
|
|
},
|
|
|
|
],
|
|
|
|
},
|
|
|
|
traits: [
|
|
|
|
{
|
2021-08-31 11:17:19 +08:00
|
|
|
type: 'core/v1/slot',
|
2021-08-12 18:59:12 +08:00
|
|
|
properties: {
|
2021-08-25 10:57:19 +08:00
|
|
|
container: {
|
2021-08-31 11:17:19 +08:00
|
|
|
id: 'parent',
|
|
|
|
slot: 'child2',
|
2021-08-25 10:57:19 +08:00
|
|
|
},
|
2021-08-12 18:59:12 +08:00
|
|
|
},
|
|
|
|
},
|
|
|
|
],
|
|
|
|
},
|
|
|
|
{
|
2021-08-31 11:17:19 +08:00
|
|
|
id: 'grandchild1_1',
|
|
|
|
type: 'core/v1/text',
|
2021-08-12 18:59:12 +08:00
|
|
|
properties: {
|
|
|
|
value: {
|
2021-08-31 11:17:19 +08:00
|
|
|
raw: '1_1',
|
|
|
|
format: 'plain',
|
2021-08-12 18:59:12 +08:00
|
|
|
},
|
|
|
|
},
|
|
|
|
traits: [
|
|
|
|
{
|
2021-08-31 11:17:19 +08:00
|
|
|
type: 'core/v1/slot',
|
2021-08-12 18:59:12 +08:00
|
|
|
properties: {
|
2021-08-25 10:57:19 +08:00
|
|
|
container: {
|
2021-08-31 11:17:19 +08:00
|
|
|
id: 'child1',
|
|
|
|
slot: 'grandchild1_1',
|
2021-08-25 10:57:19 +08:00
|
|
|
},
|
2021-08-12 18:59:12 +08:00
|
|
|
},
|
|
|
|
},
|
|
|
|
],
|
|
|
|
},
|
|
|
|
{
|
2021-08-31 11:17:19 +08:00
|
|
|
id: 'grandchild1_2',
|
|
|
|
type: 'core/v1/text',
|
2021-08-12 18:59:12 +08:00
|
|
|
properties: {
|
|
|
|
value: {
|
2021-08-31 11:17:19 +08:00
|
|
|
raw: '1_2',
|
|
|
|
format: 'plain',
|
2021-08-12 18:59:12 +08:00
|
|
|
},
|
|
|
|
},
|
|
|
|
traits: [
|
|
|
|
{
|
2021-08-31 11:17:19 +08:00
|
|
|
type: 'core/v1/slot',
|
2021-08-12 18:59:12 +08:00
|
|
|
properties: {
|
2021-08-25 10:57:19 +08:00
|
|
|
container: {
|
2021-08-31 11:17:19 +08:00
|
|
|
id: 'child1',
|
|
|
|
slot: 'grandchild1_2',
|
2021-08-25 10:57:19 +08:00
|
|
|
},
|
2021-08-12 18:59:12 +08:00
|
|
|
},
|
|
|
|
},
|
|
|
|
],
|
|
|
|
},
|
|
|
|
{
|
2021-08-31 11:17:19 +08:00
|
|
|
id: 'grandchild1_3',
|
|
|
|
type: 'core/v1/text',
|
2021-08-12 18:59:12 +08:00
|
|
|
properties: {
|
|
|
|
value: {
|
2021-08-31 11:17:19 +08:00
|
|
|
raw: '1_3',
|
|
|
|
format: 'plain',
|
2021-08-12 18:59:12 +08:00
|
|
|
},
|
|
|
|
},
|
|
|
|
traits: [
|
|
|
|
{
|
2021-08-31 11:17:19 +08:00
|
|
|
type: 'core/v1/slot',
|
2021-08-12 18:59:12 +08:00
|
|
|
properties: {
|
2021-08-25 10:57:19 +08:00
|
|
|
container: {
|
2021-08-31 11:17:19 +08:00
|
|
|
id: 'child1',
|
|
|
|
slot: 'grandchild1_3',
|
2021-08-25 10:57:19 +08:00
|
|
|
},
|
2021-08-12 18:59:12 +08:00
|
|
|
},
|
|
|
|
},
|
|
|
|
],
|
|
|
|
},
|
|
|
|
{
|
2021-08-31 11:17:19 +08:00
|
|
|
id: 'grandchild2_1',
|
|
|
|
type: 'core/v1/text',
|
2021-08-12 18:59:12 +08:00
|
|
|
properties: {
|
|
|
|
value: {
|
2021-08-31 11:17:19 +08:00
|
|
|
raw: '2_1',
|
|
|
|
format: 'plain',
|
2021-08-12 18:59:12 +08:00
|
|
|
},
|
|
|
|
},
|
|
|
|
traits: [
|
|
|
|
{
|
2021-08-31 11:17:19 +08:00
|
|
|
type: 'core/v1/slot',
|
2021-08-12 18:59:12 +08:00
|
|
|
properties: {
|
2021-08-25 10:57:19 +08:00
|
|
|
container: {
|
2021-08-31 11:17:19 +08:00
|
|
|
id: 'child2',
|
|
|
|
slot: 'grandchild2_1',
|
2021-08-25 10:57:19 +08:00
|
|
|
},
|
2021-08-12 18:59:12 +08:00
|
|
|
},
|
|
|
|
},
|
|
|
|
],
|
|
|
|
},
|
|
|
|
{
|
2021-08-31 11:17:19 +08:00
|
|
|
id: 'grandchild2_2',
|
|
|
|
type: 'core/v1/text',
|
2021-08-12 18:59:12 +08:00
|
|
|
properties: {
|
|
|
|
value: {
|
2021-08-31 11:17:19 +08:00
|
|
|
raw: '2_2',
|
|
|
|
format: 'plain',
|
2021-08-12 18:59:12 +08:00
|
|
|
},
|
|
|
|
},
|
|
|
|
traits: [
|
|
|
|
{
|
2021-08-31 11:17:19 +08:00
|
|
|
type: 'core/v1/slot',
|
2021-08-12 18:59:12 +08:00
|
|
|
properties: {
|
2021-08-25 10:57:19 +08:00
|
|
|
container: {
|
2021-08-31 11:17:19 +08:00
|
|
|
id: 'child2',
|
|
|
|
slot: 'grandchild2_2',
|
2021-08-25 10:57:19 +08:00
|
|
|
},
|
2021-08-12 18:59:12 +08:00
|
|
|
},
|
|
|
|
},
|
|
|
|
],
|
|
|
|
},
|
|
|
|
{
|
2021-08-31 11:17:19 +08:00
|
|
|
id: 'grandchild2_3',
|
|
|
|
type: 'core/v1/text',
|
2021-08-12 18:59:12 +08:00
|
|
|
properties: {
|
|
|
|
value: {
|
2021-08-31 11:17:19 +08:00
|
|
|
raw: '2_3',
|
|
|
|
format: 'plain',
|
2021-08-12 18:59:12 +08:00
|
|
|
},
|
|
|
|
},
|
|
|
|
traits: [
|
|
|
|
{
|
2021-08-31 11:17:19 +08:00
|
|
|
type: 'core/v1/slot',
|
2021-08-12 18:59:12 +08:00
|
|
|
properties: {
|
2021-08-25 10:57:19 +08:00
|
|
|
container: {
|
2021-08-31 11:17:19 +08:00
|
|
|
id: 'child2',
|
|
|
|
slot: 'grandchild2_3',
|
2021-08-25 10:57:19 +08:00
|
|
|
},
|
2021-08-12 18:59:12 +08:00
|
|
|
},
|
|
|
|
},
|
|
|
|
],
|
|
|
|
},
|
|
|
|
],
|
|
|
|
},
|
|
|
|
});
|
|
|
|
</script>
|
|
|
|
</body>
|
|
|
|
</html>
|