<template>
  <div class="noScollLine">
    <!-- 预警信息弹框 -->
    <Home_YJ v-if="isShow.showYj" :show="isShow.showYj" :data="list.Info_YJ" />
    <PopupWarning v-if="isShow.showWarning" :show="isShow.showWarning" :data="list.Info_Warning" />
  </div>
</template>

<script setup>
import emitter from "@/utils/eventBus.js";
import Home_YJ from "./components/home_yj.vue";
import PopupWarning from './components/popupWarning'
import { ref, onMounted, onUnmounted, reactive, getCurrentInstance } from "vue";
const { proxy } = getCurrentInstance();
const isShow = ref({
  showYj: false, //预警弹窗
  showWarning: false
});
const list = reactive({
  Info_YJ: [], //预警数据
  Info_Warning: [],
});

onMounted(() => {
  // 展示预警
  emitter.on("showHomeYJ", (res) => {
    isShow.value.showYj = res ? true : false;
    if (res) list.Info_YJ = res;
  });
  // 展示预警
  emitter.on("showHomeWarning", (res) => {
    isShow.value.showWarning = res ? true : false;
    if (res) list.Info_Warning = res;
  });
});
onUnmounted(() => {
  emitter.off("showHomeYJ");
  emitter.off("showHomeWarning");
});
</script>

<style lang="scss" scoped></style>
