非常粗糙的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 将 ...
随机推荐
- Notes of fwt
昨天考试由于不会fwt而爆炸,所以今天搞了一下fwt……话说这玩意的普及程度已经很高了.fwt,快速沃尔什变换,可以用于位运算卷积的优化,是一种线性变换,所以就会有许多好的性质(eg:可以直接模,可以 ...
- jq从数组中删除指定元素(根据自定义条件) 超好用的 $.grep() 方法
转: jQuery.grep() 什么是jQuery.grep()? jQuery.grep()是一个查找满足过滤函数的数组元素的函数.原始数组不受影响,返回值为数组. 用法介绍: 写法: jQuer ...
- docker-api
__author__ = 'zxp' import docker import sys class DockerManager_Slave(object): def __init__(self): s ...
- STL源码分析-traits
http://note.youdao.com/noteshare?id=b5fd9f936cd133af3790a8b0e9c35b8a
- fork系统炸弹
最近偶然看到"fork系统炸弹"的代码,小小一行shell竟然能够直接搞死系统,令人印象深刻. 代码如下 :(){ :|:& };: 咋一看有点蒙,重新排版下格式 :() ...
- 010. C++ 传值与传引用
1.参数传递 参数传递:pass by value vs. pass by reference(to const) 推荐:能传引用,尽量传引用(高效,尤其在需要拷贝的对象很大时) class comp ...
- windows中apache+tomcat整合,使php和java项目能够独立运行
一.下载和安装 1.安装php 网上有安装教程,不再赘述 2.安装apache 比如安装目录为e:\apache; 项目根目录为e:\www; 网上有安装教程,不再赘述 3.安装jdk 不再 ...
- 怎样在hibernate的HQL语句中使用mysql 的自定义函数?
问题:怎样在hibernate中使用mysql的函数? 1.hibernate支持原生态的sql语句查询,使用session.createSQLQuery()创建查询对象: 2.怎样在hql中使用my ...
- ZOJ 3781 Paint the Grid Reloaded 连通块
LINK:http://acm.zju.edu.cn/onlinejudge/showProblem.do?problemCode=3781 题意:n*m只由OX组成的矩阵,可以选择某一连通块变成另一 ...
- javascript中各类的prototype属性
prototype 作用:获取调用对象的对象原型引用 应用:可以为某对象原型添加方法 例: function getMax() { var max = this[0]; for(var x=0; x& ...