forked from RubyLouvre/anu
-
Notifications
You must be signed in to change notification settings - Fork 0
/
index9.html
89 lines (71 loc) · 1.84 KB
/
index9.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
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width">
<script type='text/javascript' src="./dist/React.js"></script>
<script type='text/javascript' src="./dist/Router.js"></script>
<script type='text/javascript' src="./lib/babel.js"></script>
</head>
Pro
<body>
<pre>React 15 </pre>
<div id='root' class="root">
</div>
<script type='text/babel'>
var container = document.getElementById("root")
if (!window.ReactDOM) {
window.ReactDOM = React;
}
var expect = function(a) {
return {
toBe: function(b) {
console.log(a, 'vs\n', b, a === b);
},
toEqual(b) {
console.log(a, 'vs\n', b, a + '' === b + '');
},
toMatch(reg){
console.log(a, 'vs', reg, reg.test(a));
},
toWarnDev(b){
throw b
}
};
};
var { Router, Link } = ReachRouter;
const Logo = () => <div>这是LOGO</div>
const App = () => (
<div>
<h1>Tutorial!</h1>
<nav>
<Link to="/">Home</Link>{" "}
<Link to="dashboard">Dashboard</Link>{" "}
<Link to="invoices/123">Invoice 123</Link>{" "}
<Link to="invoices/abc">Invoice ABC</Link>
</nav>
<Router>
<Home path="/" />
<Dashboard path="/dashboard" />
<Invoice path="invoices/:invoiceId" />
</Router>
</div>
);
const Home = () => (
<div>
<h2>Welcome</h2>
</div>
);
const Dashboard = () => (
<div>
<h2>Dashboard</h2>
</div>
);
const Invoice = (props) => (
<div>
<h2>Invoice {props.invoiceId}</h2>
</div>
);
ReactDOM.render(<App/>, container);
</script>
</html>