<template>
    <Cn-page :loading='loading'>
        <view slot='body'>
            <view class='record'>
                <uni-nav-bar dark :fixed="true" status-bar left-icon="left" rightText="关闭通知" background-color="#fff"
                    color="#111" title="告警情况" @clickLeft="back" @clickRight="messageSet" />
                <div class="header">
                    <uni-segmented-control :current="current" :values="items" :style-type="styleType"
                        :active-color="activeColor" @clickItem="onClickItem" />
                </div>
                <uni-list :border="false">
                    <uni-list-item title="输入电压异常" rightText="2023-02-01 15:10:29" v-for="item in 5" />
                </uni-list>
                <uni-load-more status="nomore"></uni-load-more>
            </view>
        </view>
    </Cn-page>
</template>
<script>
export default {
    data () {
        return {
            loading: false,
            current: 0,
            items: ['当前告警', '历史告警'],
            styleType: 'text',
            activeColor: '#007aff',
        }
    },
    methods: {
        back(){
            uni.navigateBack()
        },
        messageSet(){
            uni.showModal({
                title: '提示',
                content: '确定关闭该设备的告警通知吗？',
                showCancel: true,
                success: ({ confirm, cancel }) => {}
            })
        },
        onClickItem (e) {
            this.current = e.currentIndex
        },
    }
}
</script>
<style lang='scss'>
.record {
    .header {
        position: sticky;
        top: 0;
        left: 0;
        z-index: 10;
        background: $uni-theme-white;
        padding: 10rpx 20rpx 20rpx;
        box-shadow: 0 0 10rpx #eee;
    }
}

/deep/ .uni-list-item {
    background-color: $uni-theme-white !important;
}
</style>