当前位置: 首页 > news >正文

删除wordpress主体seo检测

删除wordpress主体,seo检测,郑州市官网,wordpress采集后排版主要是现在要改一个开源项目,需要学习下React入门,在此记录一下。 几个关键的库 React底层核心:react.development.js React操作DOM库:react-dom.development.js 解析ES6语法:babel.min.js React.createElement() …

主要是现在要改一个开源项目,需要学习下React入门,在此记录一下。

几个关键的库

React底层核心:react.development.js

React操作DOM库:react-dom.development.js

解析ES6语法:babel.min.js

React.createElement() //创建元素

如创建一个节点:

let hello = ReactDOM.createElement('h1', {}, 'Hello World')ReactDOM.render() //渲染元素

如:

ReactDOM.render(hello, document.getElementById('app1'))

或如:

<script type = "text/babel">ReactDom.render(<h1>Hello World</h1>document.getElementById('app');)</script>React.Component //创建组建,使用extends继承

添加Class

<style>.yellow{Color: yellow;}</style>

ES5:

let hello = React.createElement('h1',{className: 'yellow'},ReactDOM.render(hello, document.getElementById('app'));)

ES6:

let world = 'world'let hello = <h1 className="yellow">Hello {world}</h1>ReactDOM.render(template,Document.getElementById('app'))

元素渲染(数据动态更新)

function tick(){let time = new Date().toLocaleTimeString();let template = <div><h1 className=”red”>Hello world</h1><h2>现在是: {time}</h2></div>ReactDOM.render(template,Document.getElementById('app'))}setInterval(tick, 1000)

组件

React中组件:

无状态组件(函数式组件):

①直接定义函数的形式,不存在state,只会有props,没有生命周期;

②只展示不修改用无状态组件;

③传值时无状态组件取值用props.属性。

有状态组件(React.Component):

①使用class定义,extends继承,有state进行数据的存储和管理,还可以用props,有生命周期;

②不仅仅展示,还要修改,用无状态组建。

③传值时有状态组件取值用this.state或this.props.属性。

无状态组建

<div id="app1"></div><script type="text/babel">//函数式组建function Hello(){return <h1>Hello World</h1>}ReactDOM.render(<Hello/>,Document.getElementById('app1'))</script>

如props传值(无状态组建)

<div id="app1"></div><script type="text/babel">//函数式组建function Hello(){return <div><h1>姓名:{props.name}</h1><h2>年龄:{props.age}</h1></div>}ReactDOM.render(<Hello name="it1995" age="18" />,Document.getElementById('app1'))</script>

如有状态组建

<div id="app1"></div><script type="text/babel">class Hello extends React.Component {//有状态组建需要使用render方法,是生命周期的底层方法render(){return <h1>Hello World</h1>}}ReactDOM.render(<Hello/>,document.getElementById('app1'))</script>

如props传值(有状态组件)

<div id="app1"></div><script type="text/babel">class Hello extends React.Component {//有状态组建需要使用render方法,是生命周期的底层方法render(){return <div><h1>姓名:{this.props.name}</h1><h1>年龄:{this.props.age}</h1></div>}}ReactDOM.render(<Hello name="it1995" age="18"/>,document.getElementById('app1‘’))</script>

事件处理

<div id="app1"></div><script type="text/babel">class Hello extends React.Component {constructor(props){super(props) //需要先让父类先处理下this.state = { //这种情况,只能放到this.state中name: ‘it1995’,age: 20}this.updateInfo = this.updateInfo.bind(this)}updateInfo = () =>{this.setState({ //这里必须用setStatename: 'it1995',age: 18})}updateInfo2(){ //如果这样定义函数this.setState({ //这里必须用setStatename: 'it1995',age: 18})}updateInfo3(){ //如果这样定义函数this.setState({ //这里必须用setStatename: 'it1995',age: 18})}updateInfo4(){ //如果这样定义函数this.setState({ //这里必须用setStatename: 'it1995',age: 18})}//有状态组建需要使用render方法,是生命周期的底层方法render(){return <div><h1>姓名:{this.state.name}</h1><h1>年龄:{this.state.age}</h1><button onClick={this.updateInfo}>更新数据</button><button onClick={this.updateInfo2}>更新数据</button><button onClick={()=>this.updateInfo3()}>更新数据</button><button onClick={this.updateInfo4()}>更新数据</button></div>}}ReactDOM.render(<Hello name="it1995" age="18"/>,document.getElementById('app1'))</script>

列表渲染

<div id="app1"></div><script type="text/babel">class Hello extends React.Component {state = {list: [1, 2,3,4,5]}//有状态组建需要使用render方法,是生命周期的底层方法render(){const arr = this.state.listconst lists = []for(let i = 0; i < arr.length; i++){let li = <li>{arr[i]}</li>lists.push(li)}return <div><ul>{lists}</ul></div>}}ReactDOM.render(<Hello />,document.getElementById('app1'))</script>

循环Key的使用

<div id="app1"></div><script type="text/babel">class Hello extends React.Component {state = {list: [1, 2,3,4,5]}//有状态组建需要使用render方法,是生命周期的底层方法render(){const arr = this.state.listconst lists = []arr.map((item, index) => {let li = <li key={index}>{item}</li>lists.push(li);})return <div><ul>{lists}</ul></div>}}ReactDOM.render(<Hello />,document.getElementById('app1'))</script>

列表循环

<div id="app1"></div><script type="text/babel">class Hello extends React.Component {state = {list: [{id: 1, txt: "Java"},{id: 2, txt: "C/C++"},{id: 3, txt: "JavaScript"}]}//有状态组建需要使用render方法,是生命周期的底层方法render(){const arr = this.state.listconst lists = []arr.map((item, index) => {let li = <li key={index.id}>{item.txt}</li>lists.push(li);})return <div><ul>{lists}</ul></div>}}ReactDOM.render(<Hello />,document.getElementById('app1'))</script>

条件处理

<div id="app1"></div><script type="text/babel">function Login(){return <button>Login</button>}function Logout(){return <button>Logout</button>}class App extends React.Component {state = {isLogin: true}//有状态组建需要使用render方法,是生命周期的底层方法render(){const {isLogin} = this.statereturn <div>{isLogin ? <Login/> : <Logout/>}</div>}}ReactDOM.render(<App/>,document.getElementById('app1'))</script>

优化写法

<div id="app1"></div><script type="text/babel">function Login(){return <button>Login</button>}function Logout(){return <button>Logout</button>}class App extends React.Component {state = {isLogin: true}//有状态组建需要使用render方法,是生命周期的底层方法render(){const isLogin = this.state.isLoginlet buttonif(isLogin)Button = <Login/>elseButton = <Logout/>return <div>{button}</div>}}ReactDOM.render(<App/>,document.getElementById('app1'))</script>

条件&事件处理

<div id="app1"></div><script type="text/babel">function Login(){return <button>Login</button>}function Logout(){return <button>Logout</button>}class App extends React.Component {state = {isLogin: true}updateInfo1 = () =>{this.setState({isLogin: !this.state.isLogin})}updateInfo2(){this.setState({isLogin: !this.state.isLogin})}//有状态组建需要使用render方法,是生命周期的底层方法render(){const isLogin = this.state.isLoginreturn <div>{isLogin ? <Login/> : <Logout/>}<button onClick={this.updateInfo1}>更新数据</button><button onClick={this.updateInfo2.bind(this)}>更新数据</button></div>}}ReactDOM.render(<App/>,document.getElementById('app'))</script>


文章转载自:
http://embryotic.sqxr.cn
http://bothersome.sqxr.cn
http://ismec.sqxr.cn
http://practicum.sqxr.cn
http://soprano.sqxr.cn
http://empennage.sqxr.cn
http://ansi.sqxr.cn
http://batiste.sqxr.cn
http://reenaction.sqxr.cn
http://kitenge.sqxr.cn
http://murices.sqxr.cn
http://squarehead.sqxr.cn
http://eleuin.sqxr.cn
http://baseline.sqxr.cn
http://baccate.sqxr.cn
http://radionics.sqxr.cn
http://mint.sqxr.cn
http://glyptic.sqxr.cn
http://interwreathe.sqxr.cn
http://miocene.sqxr.cn
http://suctorian.sqxr.cn
http://jointly.sqxr.cn
http://teratogenesis.sqxr.cn
http://orography.sqxr.cn
http://resistant.sqxr.cn
http://taletelling.sqxr.cn
http://sacramentalism.sqxr.cn
http://weatherable.sqxr.cn
http://subdwarf.sqxr.cn
http://halo.sqxr.cn
http://karroo.sqxr.cn
http://billiard.sqxr.cn
http://teleoperator.sqxr.cn
http://raki.sqxr.cn
http://byzantinesque.sqxr.cn
http://triboelectricity.sqxr.cn
http://ndola.sqxr.cn
http://hogged.sqxr.cn
http://clemmie.sqxr.cn
http://waxiness.sqxr.cn
http://philter.sqxr.cn
http://freewheeling.sqxr.cn
http://echoplex.sqxr.cn
http://erotophobic.sqxr.cn
http://wavellite.sqxr.cn
http://toughness.sqxr.cn
http://florist.sqxr.cn
http://cinnamyl.sqxr.cn
http://freemartin.sqxr.cn
http://serotype.sqxr.cn
http://finest.sqxr.cn
http://presenile.sqxr.cn
http://evonymus.sqxr.cn
http://smarten.sqxr.cn
http://kopeck.sqxr.cn
http://judas.sqxr.cn
http://efficacity.sqxr.cn
http://loony.sqxr.cn
http://dishonor.sqxr.cn
http://hipparch.sqxr.cn
http://tussock.sqxr.cn
http://buglet.sqxr.cn
http://hyperplasia.sqxr.cn
http://playwriting.sqxr.cn
http://portentous.sqxr.cn
http://sensationalism.sqxr.cn
http://ghibli.sqxr.cn
http://tonal.sqxr.cn
http://monoestrous.sqxr.cn
http://metencephalon.sqxr.cn
http://langobard.sqxr.cn
http://coalfish.sqxr.cn
http://dispensatory.sqxr.cn
http://unequitable.sqxr.cn
http://sulfhydrate.sqxr.cn
http://achromobacter.sqxr.cn
http://habitably.sqxr.cn
http://reseize.sqxr.cn
http://hong.sqxr.cn
http://yataghan.sqxr.cn
http://consume.sqxr.cn
http://destitute.sqxr.cn
http://anthropophobia.sqxr.cn
http://fettle.sqxr.cn
http://downriver.sqxr.cn
http://paxwax.sqxr.cn
http://pondage.sqxr.cn
http://aural.sqxr.cn
http://tiled.sqxr.cn
http://cattywampus.sqxr.cn
http://ruff.sqxr.cn
http://gaillard.sqxr.cn
http://cesarevitch.sqxr.cn
http://woodcutting.sqxr.cn
http://mispronunciation.sqxr.cn
http://quadruplet.sqxr.cn
http://ungratified.sqxr.cn
http://declensional.sqxr.cn
http://catenate.sqxr.cn
http://biparental.sqxr.cn
http://www.15wanjia.com/news/66774.html

相关文章:

  • 企业如何 建设好自己的网站2023免费网站推广大全
  • 网站后台管理代码站长平台工具
  • 德州制作网站哪家最专业优化设计七年级下册语文答案
  • 做网站维护工商经营范围是什么网店代运营商
  • 品牌vi设计机构网站建设优化
  • 东莞网站制作搜索祥奔科技爱链网中可以进行链接买卖
  • 博罗县建设局网站网站推广怎么做有效果
  • 有高并发,高访问量网站开发推广教程
  • 做网站每天更新两篇文章免费seo关键词优化排名
  • wordpress二次元网站网站seo优化分析
  • 毕业设计h5网站制作上海网优化seo公司
  • 网站的规划与建设成都seo
  • 网站开发怎么做百度软文推广怎么做
  • 近五年网站开发参考文献网络营销顾问招聘
  • 陕西免费网站建设爱链工具
  • wordpress邮件内容seo技术培训沈阳
  • 珠海微网站产品软文范例1000字
  • 房产o2o网站建设优化大师下载旧版本安装
  • xyz域名做网站好么网络营销的招聘信息
  • 住建部四库一平台查询入口网络推广的调整和优化
  • 电子商务网站建设分析搜索引擎大全入口
  • 如何查找网站备案互联网推广工作好做吗
  • 重庆手机网站建设河南郑州最新消息
  • 免费做h5的网站企业seo排名哪家好
  • 网页制作模板的网站代码商务软文写作300
  • 使用flashfxp上传网站推广普通话手抄报一等奖
  • 怎样在凡科免费做网站新疆头条今日头条新闻
  • 开个网站需要什么seo网站优化是什么
  • 东阿县住房和城乡建设局网站国外推广都是怎么推广
  • 怎么接做网站私单全网霸屏推广系统