非常粗糙的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 将 ...
随机推荐
- 网络编程----socket介绍、基于tcp协议的套接字实现、基于udp协议的套接字实现
一.客户端/服务器架构(C/S架构) 即C/S架构,包括: 1.硬件C/S架构(打印机) 2.软件C/S架 ...
- Hexo之我的桌角女友的食用方式
秀秀 通过使用一个名为 hexo-helper-live2d 的开源库,可以轻松的在自己的Hexo网站下贴上一只生猛可爱的萌妹子或主子: 什么是live2d Live2d是11区宅男们开发出的虚拟女友 ...
- 虚拟机安装ubuntu14.04.5系统
参考教程 在vitualbox安装 ubuntu14.04.2 LTS教程 http://jingyan.baidu.com/article/46650658228345f549e5f8cc.html ...
- angular 有关侦测组件变化的 ChangeDetectorRef 对象
我们知道,如果我们绑定了组件数据到视图,例如使用 <p>{{content}}</p>,如果我们在组件中改变了content的值,那么视图也会更新为对应的值. angular ...
- novaclient源码分析
源码版本:H版 FAULT_OS_COMPUTE_API_VERSION = "1.1" 一.目录结构及概况 novaclient/ |---client.py --------- ...
- 树上的构造 树分治+树重心的性质 Codeforces Round #190 (Div. 2) E
http://codeforces.com/contest/322/problem/E E. Ciel the Commander time limit per test 1 second memor ...
- Python print "hello world" SyntaxError: invalid syntax
刚安装Python,在IDLE中输入print “Hello World”,谁知却发生错误: >>> print "Hello World"SyntaxError ...
- winform MDI子窗口闪动问题(本人测试100%有效解决闪屏问题)
将下面的代码随便放到主窗体的任何一个地方 protected override CreateParams CreateParams //解决MDI闪屏 { get { CreateParams cp ...
- 【CodeForces】889 C. Maximum Element 排列组合+动态规划
[题目]C. Maximum Element [题意]给定n和k,定义一个排列是好的当且仅当存在一个位置i,满足对于所有的j=[1,i-1]&&[i+1,i+k]有a[i]>a[ ...
- 关于servlet中重定向、转发的地址问题
先写一个正斜杠"/",再判断是服务器使用该地址还是网站使用该地址. 访问网络资源用/,访问硬盘资源用\. 例如: 转发: request.getRequestDispat ...