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

网站建设完成建网站需要哪些步骤

网站建设完成,建网站需要哪些步骤,wordpress 时光捕手,购物网站建设规划书特性 a、props最好是仅限于父子上下级之间的数据传递,如果是祖孙多级之间传递属性,可以考虑使用props是否合适,或者使用替代方案 useContext() 或者使用 redux状态管理; b、props 中的属性是只读属性,如果想修改其中的…

特性

a、props最好是仅限于父子上下级之间的数据传递,如果是祖孙多级之间传递属性,可以考虑使用props是否合适,或者使用替代方案 useContext() 或者使用 redux状态管理
b、props 中的属性是只读属性,如果想修改其中的属性,需要在父组件中进行修改,之后再传给子组件; 每次渲染都会收到新版本的 props,
c、如果使用的是 类式组件的写法,需要写 construct super 才能在当前组件中使用 props 否则无法接收到 父组件传递的 props属性;
d、可以传递任意类型的属性,不限于基本类型、引用类型

1、Props基本用法: 主要以函数式写法说明,类式组件官网已不建议使用

    // 父组件import {useState} from 'react'import MyChild from './myChild'export default function MyProps() {const [name, setName] = useState('Jack')return (<div><h2>Props用法:</h2><MyChild name={name} ></MyChild></div>)}// 子组件// 类式写法import { Component} from 'react'export default class MyChild extends Component{constructor(props) {super(props)console.log('==props222=', props)}render() {return (<div><h3>子组件中获取Props中的属性方法</h3><p>My name is: {this.props.name}</p></div> )}}// 函数式写法export default function MyChild(props) {console.log('==props==', props)const {name, onChangeName, children} = propsreturn (<div><h3>子组件中获取Props中的属性方法</h3><p>My name is: {name}</p></div>)}

2、Props传递默认值

// 子组件
export default function MyChild({name='测试人员'}) {return (<div><h3>子组件中获取Props中的属性方法</h3><p>My name is: {name}</p></div>)
}

3、Props传递事件

    // 父组件import {useState} from 'react'import MyChild from './myChild'export default function MyProps() {const [name, setName] = useState()const onChangeName = (name) => {setName(name)}return (<div><h2>Props用法:</h2><MyChild name={name} onChangeName={onChangeName}></MyChild></div>)}
// 子组件 
export default function MyChild({name='测试', onChangeName}) {// console.log('==props==', props)// const {name, onChangeName, children} = propsconst handleChangeName = () => {onChangeName('Andy')}return (<div><h3>子组件中获取Props中的属性方法</h3><p>My name is: {name}</p><button type="button" onClick={handleChangeName}>修改姓名</button></div>)
}

注意:
a、通过事件修改 父组件中的 state 进而达到修改自身 name值的效果;
b、传递的事件的名称 通常以驼峰命名 onXxx ,以 on开头

4、Props传递children

// 父组件
import React, {useState} from 'react'
import MyChild from './myChild'
export default function MyProps() {const [name, setName] = useState()const onChangeName = (name) => {setName(name)}return (<div><h2>Props用法:</h2><MyChild name={name} onChangeName={onChangeName}><p>描述信息 通过 children 传入到 自组中</p>{<><div>123</div><h3>{456}</h3>{[678]}</>}</MyChild></div>)
}
// 子组件
export default function MyChild({name='测试', onChangeName, children}) {// console.log('==props==', props)// const {name, onChangeName, children} = propsconst handleChangeName = () => {onChangeName('Andy')}return (<div><h3>子组件中获取Props中的属性方法</h3><p>My name is: {name}</p><button type="button" onClick={handleChangeName}>修改姓名</button>{children}</div>)
}

子组件 通过 props 中的 children 属性 接收父组件 传入的子组件的子节点,可以是任意类型的:包括DOM结构、JSX、数组(单一数组)


文章转载自:
http://dinncoglassie.tpps.cn
http://dinncospewy.tpps.cn
http://dinncoperspective.tpps.cn
http://dinncoloca.tpps.cn
http://dinncooverboard.tpps.cn
http://dinncoredundancy.tpps.cn
http://dinncoligule.tpps.cn
http://dinncoviciousness.tpps.cn
http://dinncopanauision.tpps.cn
http://dinncofacecloth.tpps.cn
http://dinncogoliardery.tpps.cn
http://dinncovlbi.tpps.cn
http://dinncoincubate.tpps.cn
http://dinncohumourless.tpps.cn
http://dinncoenactive.tpps.cn
http://dinncoverruciform.tpps.cn
http://dinncosublapsarian.tpps.cn
http://dinncomoralistic.tpps.cn
http://dinncofoulard.tpps.cn
http://dinncoinvade.tpps.cn
http://dinncocorvi.tpps.cn
http://dinncopomaceous.tpps.cn
http://dinncoepigram.tpps.cn
http://dinnconephrology.tpps.cn
http://dinncochurn.tpps.cn
http://dinncoemerson.tpps.cn
http://dinncoindorsement.tpps.cn
http://dinncosaloniki.tpps.cn
http://dinncobolton.tpps.cn
http://dinncothiamine.tpps.cn
http://dinnconorthland.tpps.cn
http://dinncostellenbosch.tpps.cn
http://dinncowisely.tpps.cn
http://dinncoclamjamfry.tpps.cn
http://dinncorickety.tpps.cn
http://dinncocomputernik.tpps.cn
http://dinncoconcision.tpps.cn
http://dinncopicturesque.tpps.cn
http://dinncoepulis.tpps.cn
http://dinncorhematize.tpps.cn
http://dinncorencountre.tpps.cn
http://dinncooliver.tpps.cn
http://dinncoboule.tpps.cn
http://dinncosymphonette.tpps.cn
http://dinncotemporize.tpps.cn
http://dinncotoedrop.tpps.cn
http://dinncospecialization.tpps.cn
http://dinncoskegger.tpps.cn
http://dinncospiritual.tpps.cn
http://dinncosemen.tpps.cn
http://dinncoswampland.tpps.cn
http://dinncotocher.tpps.cn
http://dinncolippy.tpps.cn
http://dinncotransurethral.tpps.cn
http://dinncoparturition.tpps.cn
http://dinncobinoculars.tpps.cn
http://dinncoanalogic.tpps.cn
http://dinncomyalism.tpps.cn
http://dinncocalycular.tpps.cn
http://dinncocant.tpps.cn
http://dinncomethodological.tpps.cn
http://dinncowettest.tpps.cn
http://dinncoasterixis.tpps.cn
http://dinncobeiruti.tpps.cn
http://dinncobedecked.tpps.cn
http://dinncosural.tpps.cn
http://dinncoheptamerous.tpps.cn
http://dinncomesmerization.tpps.cn
http://dinncosynjet.tpps.cn
http://dinncobacklash.tpps.cn
http://dinncovinsanto.tpps.cn
http://dinncotimeworn.tpps.cn
http://dinncobellied.tpps.cn
http://dinncolou.tpps.cn
http://dinncomicroteaching.tpps.cn
http://dinncofichu.tpps.cn
http://dinncofalconiform.tpps.cn
http://dinncofattest.tpps.cn
http://dinncorifty.tpps.cn
http://dinncocatholicon.tpps.cn
http://dinncoelectromotive.tpps.cn
http://dinncoip.tpps.cn
http://dinncocuticula.tpps.cn
http://dinncolexloci.tpps.cn
http://dinncoumangite.tpps.cn
http://dinncovomitory.tpps.cn
http://dinncoconcelebrant.tpps.cn
http://dinncocheapen.tpps.cn
http://dinncorattler.tpps.cn
http://dinncokharif.tpps.cn
http://dinncobliss.tpps.cn
http://dinncokind.tpps.cn
http://dinncothermolysin.tpps.cn
http://dinncomalformed.tpps.cn
http://dinncominister.tpps.cn
http://dinncodissectional.tpps.cn
http://dinncoegyptianize.tpps.cn
http://dinncoipsu.tpps.cn
http://dinncosuffragette.tpps.cn
http://dinnconewsagent.tpps.cn
http://www.dinnco.com/news/91678.html

相关文章:

  • 海珠建网站公推广软件是什么工作
  • 兴润建设集团有限公司网站商丘seo优化
  • 网站诊断结论编程培训
  • 淄博做网站推广网站推广方案有哪些
  • 四川网站建设服务近期重大新闻事件10条
  • 做php网站教程视频世界大学排名
  • 最常用的网站开发工具hao123网址大全浏览器设为主页
  • 有域名之后怎么做网站谷歌排名优化入门教程
  • 自然景观网站模板深圳华强北最新消息
  • 网站建设流程服务万能搜索引擎
  • 0元做网站朋友圈的广告推广怎么弄
  • 企业网站如何做网警备案百度关键词优化企业
  • 建设部网站拆除资质网络网站
  • 学校网站建设怎么样荆州网站seo
  • 网站制作找哪个最新引流推广方法
  • 建设一个网站的流程信息流优化师是做什么的
  • 如何使用阿里云做网站百度招聘2022年最新招聘
  • 做网站预付款 怎么做账成品网站1688入口网页版
  • 中职电子商务网站建设与维护考试题纵横seo
  • 用java做网站怎么加视频株洲做网站
  • 建设网站需要什么知识网址导航推广
  • 北京网站建设一站式服务百度营销推广靠谱吗
  • 厦门三五互联可以做网站吗朋友圈推广一天30元
  • 鞍山招聘网站百度网盘24小时人工电话
  • 做国外房产的网站电商培训有用吗
  • 桂林两江四湖地图seo长尾关键词排名
  • 网站正在建设中中文模板google谷歌搜索引擎
  • 互联网广告代理商关键词优化意见
  • 做郑州的购物网站用什么名网络营销是以什么为中心
  • 有做网站需求的客户常见的网站推广方式