-
Notifications
You must be signed in to change notification settings - Fork 15
/
index.js
68 lines (57 loc) · 1.82 KB
/
index.js
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
import React, { Component } from 'react'
import Marquee from '../../modules/index'
import './index.css'
class MarqueePage extends Component {
constructor(props, context) {
super(props, context);
this.state = {
loopData: [
{ txt: "这是一条数据1" },
{ txt: "这是一条数据2" },
{ txt: "这是一条数据3" },
{ txt: "这是一条数据4" },
{ txt: "这是一条数据5" }
]
}
}
render() {
let { loopData } = this.state;
return (
<div>
<div className="type-title">默认横向滚动</div>
<div className="box-landscape">
<Marquee loopData={loopData} getMarquee={this.getLandscapeMarquee} />
</div>
<div className="botton" onClick={this.runlandscapeMarquee}>运动</div>
<div className="botton" onClick={this.stoplandscapeMarquee}>暂停</div>
<div className="type-title">竖向滚动</div>
<div className="box-vertical">
<Marquee loopData={loopData} getMarquee={this.getVerticalMarquee} direction='vertical' verticalItemHeight='60px' />
</div>
<div className="botton" onClick={this.runVerticalMarquee}>运动</div>
<div className="botton" onClick={this.stopVerticalMarquee}>暂停</div>
</div>
)
}
// 横向
getLandscapeMarquee = (params) => {
this.landscapeMarqueeParams = params
}
stoplandscapeMarquee = () => {
this.landscapeMarqueeParams.stopMarquee();
}
runlandscapeMarquee = () => {
this.landscapeMarqueeParams.runMarquee();
}
//竖向
getVerticalMarquee = (params) => {
this.verticalMarqueeParams = params
}
stopVerticalMarquee = () => {
this.verticalMarqueeParams.stopMarquee();
}
runVerticalMarquee = () => {
this.verticalMarqueeParams.runMarquee();
}
}
export default MarqueePage