<template>
    <Cn-page :loading='loading'>
        <view slot='body'>
            <view class='device-list'>
                <div class="header">
                    <uni-segmented-control :current="current" :values="items" :style-type="styleType"
                        :active-color="activeColor" @clickItem="onClickItem" />
                </div>
                <uni-card title="基础设备" sub-title="副标题" extra="APF" v-for="item in 10" :key="item"
                    thumbnail="/static/real_time_data.png">
                    <text>设备基础信息 </text>
                </uni-card>
                <uni-load-more  status="nomore"></uni-load-more>
                <uni-fab ref="fab" horizontal="right" vertical="bottom" :content="content" @trigger="trigger" />
            </view>
        </view>
    </Cn-page>
</template>
<script>
export default {
    data () {
        return {
            loading: false,
            current: 0,
            items: ['正常', '报警', '离线'],
            styleType: 'text',
            activeColor: '#007aff',
            content: [{
                iconPath: '/static/add.png',
                text: '添加 ',
            },
            ]
        }
    },
    methods: {
        onClickItem (e) {
            this.current = e.currentIndex
        },
        trigger (e) {
            if (e.index === 0) {
                uni.navigateTo({
                    url: '/pages/device/new'
                })
            }
        }
    }
}
</script>
<style lang='scss'>
.device-list {
    .header {
        position: sticky;
        top: 0;
        left: 0;
        z-index: 10;
        background: #fff;
        padding: 10rpx 20rpx 20rpx;
        box-shadow: 0 0 10rpx #eee;
    }
}
</style>