非常粗糙的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 将 ...
随机推荐
- SNMP-网络管理协议
SNMP协议简介: a. 轮询(Polling) -- 定时获取状态, 中断(Interrupt)--出问题通知 b. 共同体名(community) -- 口令--只读口令 --读写口令 使用SNM ...
- APIO2017
商旅 在广阔的澳大利亚内陆地区长途跋涉后,你孤身一人带着一个背包来到了科巴.你被这个城市发达而美丽的市场所 深深吸引,决定定居于此,做一个商人.科巴有个集市,集市用从1到N的整数编号,集市之间通过M条 ...
- 【数学】【P5076】 Tweetuzki 爱整除
Description 对于一个数 \(k\),找到任意一个 \(x\),满足 \(0~\leq~k~\leq~x~\leq~10^{18}\) 且对于任意一个 \(x\) 进制数,把该数字各数位上的 ...
- chrome插件控制台
在manifest.json中添加下面的几行 "background": { "scripts": ["background.js"] }, ...
- SDK代码记录
zynq中SDK相关API的学习.记录常用函数 /*************************************************************************** ...
- JAVA多线程提高十一:同步工具Exchanger
Exchanger可以在对中对元素进行配对和交换的线程的同步点.每个线程将条目上的某个方法呈现给 exchange 方法,与伙伴线程进行匹配,并且在返回时接收其伙伴的对象.Exchanger 可能被视 ...
- mysql 修改密码的几种方式
第一种方式: 最简单的方法就是借助第三方工具Navicat for MySQL来修改,方法如下: 1.登录mysql到指定库,如:登录到test库. 2.然后点击上方“用户”按钮. 3.选择要更改的用 ...
- php输出日志的实现
php输出日志的实现 思想:在想要输出log日志的地方,使用php的写入文件函数,把数据写入到事先定义好的文件中. php代码如下: //输出日志 public function outputLog( ...
- 针对移动设备的CSS3布局
针对移动设备的CSS3布局 一些专业人士预测五年内移动设备将击败普通电脑成为网页浏览领域的霸主,不管这个预言是否应验,让网页在移动设备上较好的显示已经成为网页设计师和开发者的重要任务,本教程学习用CS ...
- 【vijos】P1190 繁忙的都市
[算法]最小生成树 #include<cstdio> #include<algorithm> using namespace std; ; ]; int fa[maxn],he ...