6月12日 => 星期五

1,面包屑導(dǎo)航父子組件傳值

image.png

父頁面.jsx

# 定義一個數(shù)組
this.state = {
    data: [
        { pages: '數(shù)據(jù)可視化AAA', path: '/數(shù)據(jù)可視化22'},
        { pages: '我的數(shù)據(jù)集', path: '/我的數(shù)據(jù)集22'},
    ]
};
# 引入組件,傳遞數(shù)據(jù)
<Crumbs data={this.state.data}/>

子頁面.jsx

# props屬性接收數(shù)據(jù)
{
    this.props.data.map((item, index) => {
            return (
                <Breadcrumb.Item className='GotoPages' href={item.path} key={index}>
                    <span className='GotoPagesText'>{item.pages}</span>
                </Breadcrumb.Item>
            )
    })
}                         

2,

?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請聯(lián)系作者
【社區(qū)內(nèi)容提示】社區(qū)部分內(nèi)容疑似由AI輔助生成,瀏覽時請結(jié)合常識與多方信息審慎甄別。
平臺聲明:文章內(nèi)容(如有圖片或視頻亦包括在內(nèi))由作者上傳并發(fā)布,文章內(nèi)容僅代表作者本人觀點(diǎn),簡書系信息發(fā)布平臺,僅提供信息存儲服務(wù)。

友情鏈接更多精彩內(nèi)容