【发布时间】:2020-04-21 00:10:13
【问题描述】:
我想写下面的代码在Reactjs怎么做
@foreach($slide as $item)
<li data-target="#caImg" data-slide-to="{{ $loop->index }}" class="{{ ($loop->first)? 'active':'' }}"></li>
@endforeach
和
@foreach($slide as $item)
<div class="carousel-item {{ ($loop->first)? 'active':'' }}">
<src={{$item->image}}/>
</div>
@endforeach
我的代码 React.js
{
slides.map((value, index) => {
return (
<li
key={value.id}
data-target="#carouselHomeIndicators"
data-slide-to={index}
className={index === 0 ? 'active' : ''}
/>
);
});
}
【问题讨论】:
-
如果您不是在寻找错误修复或其他东西,那么它肯定 stackoveflow 是正确的。所以你尝试过的东西
标签: reactjs react-native