hogenwang/comcms_core

首页非空判断缺

Opened this issue · 0 comments

<!-- pc banner  -->
<div class="banner normal">
    <div class="swiper-container">
        <div class="swiper-wrapper">
            @{
                if(bannerPC != null && bannerPC.Any())
                {
                    foreach (var img in bannerPC)
                    {
                        <div class="swiper-slide">
                            <a href="@img.link" title="@(img.alt)" style="background: url('@img.img') center top no-repeat; background-size:cover"></a>
                        </div>
                    }
                }
            }
        </div>
        <div class="cont">
            <span class="banner-prev"></span>
            <span class="banner-next"></span>
        </div>
    </div>
</div>
<!-- mb banner -->
<div class="banner mobile">
    <div class="swiper-container">
        <div class="swiper-wrapper">
             @{
                if(bannerPC != null && bannerPC.Any())
                {
                    foreach (var img in bannerPC)
                    {
                    <div class="swiper-slide">
                        <a href="@img.link" title="@(img.alt)" style="background: url('@img.img') center top no-repeat; background-size: 100%;"></a>
                    </div>
                    }
                }
             }
        </div>
    </div>
</div>