-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdemo-0.39941848359358545.html
152 lines (145 loc) · 4.55 KB
/
demo-0.39941848359358545.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
<!DOCTYPE html>
<html>
<head>
<title>Demo</title>
<link rel="stylesheet" href="../index.css" />
<link rel="stylesheet" href="../index-1.css" />
<link rel="stylesheet" href="../index-2.css" />
<style>
html, body {
height: 100%;
margin: 0;
background: none;
}
.demo {
margin: 16px;
}
.demo-nav {
height: 30px;
line-height: 30px;
margin-bottom: 16px;
background: #f8f8f8;
}
.demo-nav a {
line-height: 30px;
padding: 0 8px;
}
.app-list {
margin-top: 16px;
}
</style>
<script>
// sync parent style generated by style-loader into iframe
if (parent.location.port) {
[].forEach.call(parent.document.getElementsByTagName('head')[0].querySelectorAll('style'), function(node) {
document.getElementsByTagName('head')[0].appendChild(node.cloneNode(true));
});
}
</script>
</head>
<body>
<div id="components-breadcrumb-demo-router-4"></div>
<script>
function require(module) {
if (module === 'react-router') {
return window.ReactRouter;
}
if (module === 'react-router-dom') {
return window.ReactRouterDOM;
}
return window.parent[module];
}
var mountNode = document.getElementById('components-breadcrumb-demo-router-4');
var React = require('react');
var ReactDOM = require('react-dom');
</script>
<script src="https://unpkg.com/react-router-dom@4/umd/react-router-dom.min.js"></script>
<script>
function bishengPluginReactPreviewer() {
var React = require("react");
var ReactDOM = require("react-dom");
var _reactRouterDom = require("react-router-dom");
var _antd = require("antd");
var Apps = function Apps() {
return React.createElement("ul", {
className: "app-list"
}, React.createElement("li", null, React.createElement(_reactRouterDom.Link, {
to: "/apps/1"
}, "Application1"), "\uFF1A", React.createElement(_reactRouterDom.Link, {
to: "/apps/1/detail"
}, "Detail")), React.createElement("li", null, React.createElement(_reactRouterDom.Link, {
to: "/apps/2"
}, "Application2"), "\uFF1A", React.createElement(_reactRouterDom.Link, {
to: "/apps/2/detail"
}, "Detail")));
};
var breadcrumbNameMap = {
'/apps': 'Application List',
'/apps/1': 'Application1',
'/apps/2': 'Application2',
'/apps/1/detail': 'Detail',
'/apps/2/detail': 'Detail'
};
var Home = (0, _reactRouterDom.withRouter)(function (props) {
var location = props.location;
var pathSnippets = location.pathname.split('/').filter(function (i) {
return i;
});
var extraBreadcrumbItems = pathSnippets.map(function (_, index) {
var url = "/".concat(pathSnippets.slice(0, index + 1).join('/'));
return React.createElement(_antd.Breadcrumb.Item, {
key: url
}, React.createElement(_reactRouterDom.Link, {
to: url
}, breadcrumbNameMap[url]));
});
var breadcrumbItems = [React.createElement(_antd.Breadcrumb.Item, {
key: "home"
}, React.createElement(_reactRouterDom.Link, {
to: "/"
}, "Home"))].concat(extraBreadcrumbItems);
return React.createElement("div", {
className: "demo"
}, React.createElement("div", {
className: "demo-nav"
}, React.createElement(_reactRouterDom.Link, {
to: "/"
}, "Home"), React.createElement(_reactRouterDom.Link, {
to: "/apps"
}, "Application List")), React.createElement(_reactRouterDom.Switch, null, React.createElement(_reactRouterDom.Route, {
path: "/apps",
component: Apps
}), React.createElement(_reactRouterDom.Route, {
render: function render() {
return React.createElement("span", null, "Home Page");
}
})), React.createElement(_antd.Alert, {
style: {
margin: '16px 0'
},
message: "Click the navigation above to switch:"
}), React.createElement(_antd.Breadcrumb, null, breadcrumbItems));
});
return React.createElement(_reactRouterDom.HashRouter, null, React.createElement(Home, null));
}
</script>
<script>
var ReactDOM = require('react-dom');
var app = bishengPluginReactPreviewer();
if (true) {
var container = null;
app = React.createElement(
require('antd').ConfigProvider,
{
getPopupContainer() { return container; },
},
[
app,
React.createElement('div', { ref(node) { container = node; }, }),
],
);
}
ReactDOM.render(app, mountNode);
</script>
</body>
</html>