Skip to content

Commit 39db89f

Browse files
李钿李钿
authored andcommitted
First version code
1 parent 227cddb commit 39db89f

22 files changed

+983
-0
lines changed

example/App.jsx

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
import React, { Component } from 'react';
2+
import { render } from 'react-dom';
3+
import PropTypes from 'prop-types';
4+
5+
import WxImageViewer from 'index.js';
6+
import './App.less';
7+
8+
class App extends Component {
9+
10+
state = {
11+
imags: [
12+
require('./assets/2.jpg'),
13+
require('./assets/1.jpg'),
14+
require('./assets/0.jpg'),
15+
require('./assets/3.jpg'),
16+
require('./assets/4.jpg'),
17+
]
18+
};
19+
20+
render() {
21+
return (
22+
<div className="app">
23+
<div className="img-list">
24+
{
25+
this.state.imags.map(item => {
26+
console.info("111",item);
27+
return <div className="img">
28+
<img src={item} alt="" width="100%" height="auto" className=""/>
29+
</div>
30+
})
31+
}
32+
</div>
33+
<WxImageViewer urls={this.state.imags} index={2}/>
34+
</div>
35+
)
36+
}
37+
}
38+
39+
export default App;

example/App.less

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
2+
.app{
3+
.img-list{
4+
display: flex; justify-content: space-between; flex-wrap: wrap;
5+
.img{
6+
width: 33.3%;
7+
}
8+
}
9+
}

example/assets/0.jpg

281 KB
Loading

example/assets/1.jpg

173 KB
Loading

example/assets/2.jpg

89.9 KB
Loading

example/assets/3.jpg

97.9 KB
Loading

example/assets/4.jpg

66.6 KB
Loading

example/index.html

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
<!DOCTYPE html>
2+
<html lang="en">
3+
<head>
4+
<meta charset="UTF-8">
5+
<title>WxImageViewer demo</title>
6+
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=0">
7+
</head>
8+
<body>
9+
<div id="root"></div>
10+
<!--
11+
bundle1.js is demo use document as contianer
12+
bundle2.js is demo use ReactPullLoad root DOM as contianer
13+
-->
14+
</body>
15+
</html>

example/main.js

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
import React from 'react';
2+
import ReactDOM from 'react-dom';
3+
4+
import { AppContainer } from 'react-hot-loader';
5+
// AppContainer 是一个 HMR 必须的包裹(wrapper)组件
6+
7+
import App from './App.jsx';
8+
9+
const render = (Component) => {
10+
ReactDOM.render(
11+
<AppContainer>
12+
<Component/>
13+
</AppContainer>,
14+
document.getElementById('root')
15+
);
16+
};
17+
18+
render(App);
19+
20+
// 模块热替换的 API
21+
if (module.hot) {
22+
module.hot.accept('./App.jsx', () => {
23+
render(App)
24+
});
25+
}

index.html

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
<!DOCTYPE html>
2+
<html lang="en">
3+
<head>
4+
<meta charset="UTF-8">
5+
<title>ReactPullLoad demo</title>
6+
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=0">
7+
</head>
8+
<body>
9+
<div id="root"></div>
10+
<!--
11+
bundle1.js is demo use document as contianer
12+
bundle2.js is demo use ReactPullLoad root DOM as contianer
13+
-->
14+
<script type="text/javascript" src="demo/main.js?4c701ed503df2b1d0ff2"></script></body>
15+
</html>

0 commit comments

Comments
 (0)