3-1 详情页面 布局

上面我们把首页以及首页跳转到详情页面的部分写好了。接下来,我们开始写详情页面。

我们在 src/pages/detail 下新建 style.js 文件。

import styled from 'styled-components';

export const DetailWrapper = styled.div`
    overflow: hidden;
    width: 620px;
    margin: 0 auto;
    padding-bottom: 100px;
`;

export const Header = styled.div`
    margin: 50px 0 20px 0;
    line-height: 44px;
    font-size: 34px;
    color: #333;
    font-weight: bold;
`;

export const Content = styled.div`
    color: #2f2f2f;
    img {
        width: 100%;
    }
    p {
        margin: 25px 0;
        font-size: 16px;
        line-height: 30px;
    }
    b {
        font-weight: bold;
    }
`;

然后 src/pages/detail 下的 index.js 如下。

import React, {Component} from 'react';
import { DetailWrapper,
    Header,
    Content
 } from './style';

class Detail extends Component {
    render () {
        return (
            <DetailWrapper>
                <Header>标题</Header>
                <Content>
                    <img src="//upload-images.jianshu.io/upload_images/2257068-610cbe7de087b61c?imageMogr2/auto-orient/strip%7CimageView2/2/w/1000/format/webp" />
                    <p>说走就走的旅行,不是不管不顾不闻不问的去往某一个地方,而是今晚决定了,就妥善处理好工作,再做好攻略,明天一早就启程。</p>
                    <p>时间像是静止的,而流动的是人群。</p>
                    <p>草地成了孩子们的乐园,擒着心爱的玩具,小跑小闹,这个画面最欢喜。</p>
                    <p><b>当时距离有点远</b>,长焦段下拍的画面,画质不好,但依旧生动,依旧能感受到孩子的那种喜悦。</p>
                </Content>
            </DetailWrapper>
        )
    }
}

export default Detail;

 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值