非常粗糙的react网页ppt
import React, {Component} from 'react';
import './slide.css';
class Page extends Component {
constructor(props) {
super(props);
}
render() {
return (
<div className='page' id={this.props.page}>
{this.props.content}
</div>
);
}
}
class NextBtn extends Component {
constructor(props) {
super(props);
this.next = this.next.bind(this);
}
next() {
let cur = this.props.cur;
cur++;
this.props.handleGoTo(cur);
}
render() {
return (
<div id='next' onClick={this.next}>
next
</div>
);
}
}
class PrevBtn extends Component {
constructor(props) {
super(props);
this.prev = this.prev.bind(this);
}
prev() {
let cur = this.props.cur;
cur--;
this.props.handleGoTo(cur);
}
render() {
return (
<div id='prev' onClick={this.prev}>
prev
</div>
);
}
}
class Slide extends Component {
constructor(props) {
super(props);
this.state = {
num: 4,
cur: 1
};
this.getContent = this.getContent.bind(this);
this.goToPage = this.goToPage.bind(this);
}
getContent() {
return [
'hello',
'hi',
'tom',
'jan'
]
}
goToPage(cur) {
// window.location.hash = '#' + this.state.cur;
if (cur < 1 || cur > this.state.num) {
return
}
this.setState({
cur: cur
});
window.location.hash = '#' + cur;
}
render() {
let html = [];
for (let i = 0; i<4; i++) {
html.push(<Page key={i} page={i+1} content={this.getContent()[i]}/>);
}
return (
<div className='slide'>
<NextBtn cur={this.state.cur} handleGoTo={this.goToPage}/>
<PrevBtn cur={this.state.cur} handleGoTo={this.goToPage}/>
{html}
</div>
);
}
}
export default Slide;
非常粗糙的react网页ppt的更多相关文章
- Cleaver快速制作网页PPT
原文首发链接:http://www.jeffjade.com/2015/10/15/2015-10-16-cleaver-make-ppt/ 写在开始之前 互联网时代,以浏览器作为入口,已经有越来越多 ...
- react网页版聊天|仿微信、微博web版|react+pc端仿微信实例
一.项目介绍 基于react+react-dom+react-router-dom+redux+react-redux+webpack2.0+nodejs等技术混合开发的仿微信web端聊天室react ...
- 6最好的之一 HTML5/CSS3 演示(PPT)框架
HTML 是全世界最流行的网页编程语言.而HTML5是这门语言的升级版本号.越来越多的开发人员和设计师開始使用HTML5.以下介绍几个 HTML5/CSS3 的演示工具和框架,你能够用它们来创建你的网 ...
- react中文API解读二(教程)
记下自己的react学习之路 ,官方文档写的很详尽,学起来应该比较简单 官方文档地址:react.http://reactjs.cn/react/docs/getting-started.html 2 ...
- 教你用Python Jupyter Notebook 制作代码分享 PPT
PPT 是个强大的工具,但是笔者的 PPT 制作技术不咋地,所以之前的分享习惯使用 Jupyter Notebook + RISE,这样使用简单的 markdown 格式加上代码就足够做一次代码分享了 ...
- 基于react开发package.json的配置
项目依赖 react网页开发的3件套: react, react-dom, react-router-dom, redux, react-reduxreact的UI组件库: antd(pc端), an ...
- React 入门笔记
一.什么是React React: A JAVASCRIPT LIBRARY FOR BUILDING USER INTERFACES 上面的话直译过来就是,React是一个用于构建用户界面的Java ...
- github上最全的资源教程-前端涉及的所有知识体系
前面分享了前端入门资源汇总,今天分享下前端所有的知识体系. 个人站长对个人综合素质要求还是比较高的,要想打造多拉斯自媒体网站,不花点心血是很难成功的,学习前端是必不可少的一个环节, 当然你不一定要成为 ...
- web 常用开发工具
he把字符转化为实体字符 awesome-vue Vue资源 clipboard.js 粘贴板 Share.js 一键分享 nock 模拟异步数据 Clamp.js 限制文本最大行数 pinyin 将 ...
随机推荐
- 洛谷 P2824 [HEOI2016/TJOI2016]排序 解题报告
P2824 [HEOI2016/TJOI2016]排序 题意: 有一个长度为\(n\)的1-n的排列\(m\)次操作 \((0,l,r)\)表示序列从\(l\)到\(r\)降序 \((1,l,r)\) ...
- windows下载执行命令大全
1.bitsadmin命令(只能命令下载到指定路径上,win7以上): bitsadmin /transfer myDownLoadJob /download /priority normal & ...
- poj 1945 Power Hungry Cows A*
Description: 就是给你一个数,你可以把它自乘,也可以把他乘或除以任意一个造出过的数,问你最多经过多少次操作能变换成目标数 思路:这题真的不怎么会啊.n = 20000,每一层都有很 ...
- [树莓派]wifi在面板看不到,但是可以scan到的解决方案
突然遇到一个问题,发现在wifi面板中找不到WiFi,但是运行scan命令可以发现WiFi,多方查找资料终于找到了一个解决方案: 运行如下命令: sudo apt-get install wicd ...
- 「Django」rest_framework学习系列-API访问跨域问题
#以中间件方式解决API数据访问跨域问题1.API下新建文件夹下写PY文件a.引入内置类继承: from django.middleware.common import MiddlewareMixin ...
- mysql 在linux服务器恢复数据表方法记录
在本地搭建测试环境录入的数据放到线上测试,备份了数据表为一个.sql文件, 在服务器上登录mysql执行 source (如:source exposition_exposition.sql) 文件路 ...
- poj 1067 取石子游戏 (威佐夫博弈)
取石子游戏 http://poj.org/problem?id=1067 Time Limit: 1000MS Memory Limit: 10000K Description 有两堆 ...
- 非法字符:"\ufeff"
Eclipse项目导入IDEA可能遇到这样的问题 ,原因就是: 带BOM的UTF-8」和「无BOM的UTF-8」 方法一.用Notepad++把文件转成无BOM的UTF-8 另存为,替换原来的文件 方 ...
- JAVA中反射机制三
声明:如需转载请说明地址来源:http://www.cnblogs.com/pony1223 反射三 利用反射获取对象的方法,并调用方法 1.利用反射获取对象的方法,我们仍然利用上面的Person类, ...
- (64位)本体学习程序(ontoEnrich)系统配置说明文档
1系统环境 64位 Ubuntu 2 第三方依赖库配置 boost_1_44_0 #解压boost_1_44_0.tar.gz 到 /usr/local.如果出现权限问题,请用sudo执行该命令 ta ...