Skip to content

Commit d86995d

Browse files
committed
add(swiper): demo
1 parent bc8bb2c commit d86995d

File tree

11 files changed

+74
-20
lines changed

11 files changed

+74
-20
lines changed

.idea/jsLinters/eslint.xml

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

my-app/src/test/reduce.js

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
/**
2+
* Created by joey on 13/11/2016.
3+
*/
4+
5+
6+
const flat = {}
7+
8+
const array = [[0, 1], [2, 3], [4, 5]]
9+
const result = array.reduce((memo, item, index) => {
10+
const flatten = memo.concat(item)
11+
flat[index] = flatten
12+
return flatten
13+
})
14+
15+
console.log(flat)
16+
17+
18+
19+
console.log(foo)
20+
const foo = function foo() {
21+
return null
22+
}
23+
24+
const ar = [1, 2, 3]
25+
ar.map(function (x) {
26+
const y = x + 1;
27+
console.log(x + y)
28+
return x * y;
29+
});
30+
31+
console.error(y)
32+
33+
ar.map((x) => {
34+
const y = x + 1;
35+
console.log(x + '-----' + y)
36+
return x * y;
37+
});
38+
39+
const ab = [1, 22, 333]
40+
const ba = [...ab]

react-swipeable/src/App.css

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,3 @@
2323
to { transform: rotate(360deg); }
2424
}
2525

26-
#test{
27-
width: 400px;
28-
height: 400px;
29-
}
30-

react-swipeable/src/App.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,16 +12,16 @@ class App extends Component {
1212

1313
static defaultProps = {
1414
children: [
15-
<div id="test">
15+
<div className="slide slide0">
1616
{'slide n°0'}
1717
</div>,
18-
<div id="test">
18+
<div className="slide slide1">
1919
{'slide n°1'}
2020
</div>,
21-
<div id="test">
21+
<div className="slide slide2">
2222
{'slide n°2'}
2323
</div>,
24-
<div id="test">
24+
<div className="slide slide3">
2525
{'slide n°3'}
2626
</div>,
2727
]
@@ -59,7 +59,7 @@ class App extends Component {
5959
let {children} = this.props;
6060
let childrenLength = children.length;
6161

62-
let index = mod(this.state.index + number, childrenLength)
62+
let index = this.state.index + number
6363
this.setState({
6464
index: index
6565
})

react-swipeable/src/App.test.js

Lines changed: 0 additions & 8 deletions
This file was deleted.

react-swipeable/src/CustomAutoPlay.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,6 @@ class CustomAutoPlay extends Component {
102102
changeIndex = (index)=> {
103103
let {children}=this.props;
104104
let childrenLength = children.length;
105-
index = mod(index, childrenLength);
106105
let {changeIndexCallBack}=this.props;
107106
changeIndexCallBack && changeIndexCallBack(index)
108107

react-swipeable/src/img/1.jpg

31.9 KB
Loading

react-swipeable/src/img/2.jpg

20.4 KB
Loading

react-swipeable/src/img/3.jpg

51 KB
Loading

react-swipeable/src/img/4.jpg

28.6 KB
Loading

react-swipeable/src/index.css

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,4 +18,32 @@ body {
1818
.button{
1919
padding: 40px 0;
2020
text-align: center;
21+
}
22+
23+
.slide {
24+
width: 100%;
25+
height: 400px;
26+
display: flex;
27+
align-items: center;
28+
justify-content: center;
29+
}
30+
31+
.slide0 {
32+
background-repeat: no-repeat;
33+
background-image: url('./img/1.jpg');
34+
}
35+
36+
.slide1 {
37+
background-repeat: no-repeat;
38+
background-image: url('./img/2.jpg');
39+
}
40+
41+
.slide2 {
42+
background-repeat: no-repeat;
43+
background-image: url('./img/3.jpg');
44+
}
45+
46+
.slide3 {
47+
background-repeat: no-repeat;
48+
background-image: url('./img/4.jpg');
2149
}

0 commit comments

Comments
 (0)