<view class="home">
    <view class="home_top">
        <view class="home_header">
            <view class="index_title">早上好, 嘟嘟</view>
            <view slot="message" class="index_message" bind:tap="goMessage">
                <image mode="widthFix" lazy-load="true" src="/assets/images/xian/icon_message.png" />
                <mpbadge ext-class="mpbadge" content="99+" />
            </view>
        </view>
        <view class="home_swiper">
            <swiper style="height: 100%" indicator-dots="{{indicatorDots}}" indicator-color="{{indicatorColor}}" indicator-active-color="{{indicatorActiveColor}}" autoplay="{{autoplay}}" circular="{{circular}}" interval="{{interval}}" duration="{{duration}}">
                <block ty:for="{{background}}" ty:key="*this">
                    <swiper-item>
                        <image src="{{item}}" mode="widthFix" lazy-load="true"></image>
                    </swiper-item>
                </block>
            </swiper>
        </view>
    </view> 
    <view class="home_device">
        <view class="device_header">
            <view class="device_title">所有设备</view>
            <view class="device_add img_box" bind:tap="goAddDevice">
                <image mode="widthFix" lazy-load="true" src="/assets/images/xian/icon_add.png " />
            </view> 
        </view>
        <view class="device_list" ty:if="{{device_list.length > 0}}">
            <view class="device_box" ty:for="{{device_list}}" ty:key="{{index}}">
                <view class="device_box_img img_box">
                    <image class="image" src="{{item.imgUrl}}" mode="widthFix"></image>
                </view>
                <view class="device_box_title">{{item.name}}</view>
                <view class="device_box_switch" data-id="{{index}}" bind:tap="handleSwitch" style="background-image: url({{item.switch ? '/assets/images/xian/icon_on.png' : '/assets/images/xian/icon_off.png'}})"></view>
            </view>
        </view>
        <view class="nodevice" ty:else>
            <view class="nodevice_img img_box">
                <image class="image" src="/assets/images/xian/home_nodevice_bg.png" mode="widthFix"></image>
            </view>
            <view class="nodevice_text">您还没有添加任何设备，请添加您想要管理的智能设备</view>
            <view class="nodevice_btn" bind:tap="goAddDevice">+添加设备</view>
        </view>
    </view>
</view>

