使用React做个简单的页面-02

项目实战之首页模块

     实现轮播图

      1.页面效果

       

代码实现


pc_index.js页面

   

加载新闻

   页面 效果

   

代码实现

 


加载图片

   页面效果

  

代码实现

  

图片组件代码

import React from 'react';
import { Card} from 'antd';
import { Router, Route, Link, browserHistory} from 'react-router'
export default class PCNewsImageBlock extends React. Component {
     constructor() {
         super();
         this. state = {
             news: ''
        };
    }
     componentWillMount() {
         var myFetchOptions = {
             method: 'GET'
        };
         fetch( "http://newsapi.gugujiankong.com/Handler.ashx?action=getnews&type=" + this. props. type + "&count=" + this. props. count, myFetchOptions). then( response => response. json()). then( json => this. setState({ news: json}));
    };
     render() {
         const styleImage = {
             display: "block",
             width: this. props. imageWidth,
             height: "90px"
        };
         const styeH3 = {
             width: this. props. imageWidth,
             whiteSpace: "nowrap",
             overflow: "hidden",
             textOverflow: "ellipsis"
        };
         const { news} = this. state;
         const newsList = news. length
            ? news. map(( newsItem, index) => (
                 < div key= { index } class= "imageblock" >
                     < Link to= { `details/
  • 0
    点赞
  • 9
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值