2017-09-25 7 views
0

なぜ繰り返しの機能がうまくいかないのでしょうか? ComponentDidMountでcomponentdidmountではconsole.logには、私は(rendercarouselitemプロセスの作業にconsole.logのためではない関数からカルーセル項目を構築レンダリングするときブートストラップカルーセルはcomponentDidMountの各jqueryを処理できません

renderCarouselItem() { 
    console.log('(3) testing carousel di sebelum render'); 
    return _.map(this.props.editor_pick_data, function (value, key){ 
     return (
     pug` 
     .carousel-item(className=${key == 0 ? 'active' : ''}, key=${key}, style=${{display: 'relative'}}) 
      .col-md-3.col-sm-6.col-xs-12 
      a.thumbnail(href="#") 
       img.img-responsive(src=${value.item.images[1].big_thumbnail}) 
     ` 
    ) 
    }) 
    } 

    render(){ 
    return (
     pug ` 
     div(style=${{background: 'red', height: 'auto'}}) 
      .col-lg-12.col-lg-centered.col-md-10.col-sm-8.col-sm-centered.col-md-centered.columns(style=${{height: 'auto'}}) 
      h2.divider Editor's Picks 
      .col-md-12 
       #carousel.carousel.slide(data-ride="carousel" data-type="multi" data-interval="1000") 
       .carousel-inner 
        ${this.renderCarouselItem()} 
       a.carousel-control-prev(href="#carousel" role="button" data-slide="prev") 
        span.carousel-control-prev-icon(aria-hidden="true") 
        span.sr-only Previous 
       a.carousel-control-next(href="#carousel" role="button" data-slide="next") 
        span.carousel-control-next-icon(aria-hidden="true") 
        span.sr-only Next 
     ` 
    ) 
    } 

    componentDidMount() { 
    console.log('teslah termount') 
    this.props.fetchEditorPick(); 

    $('#carousel[data-type="multi"] .carousel-item').each(function(){ 
     console.log('(1) testing carousel in didmount') 
    }) 
    } 

を表示されますがありませんが)2倍

答えて

0

をCONSOLE.LOGます私はしませんよあなたのレンダリングは何も返されていないが、どのようなパグですか。

+0

oh sory私の間違いは、レンダリングで戻り値を入力するのを忘れてしまった。 pugは開発用のコードを簡単に書くためのものです –

関連する問題