<template>
  <div class="msg" v-if="show">
    <img src="../icon/info.svg" width="18" alt="" />
    <div class="text">
      {{ msg }}
    </div>
  </div>
</template>

<script>
export default {
  name: "Message",
  // props: {
  //   msg: { type: String, required: true },
  // },
  data() {
    return {
      show: false,
    };
  },
  methods: {
    showMsg() {
      this.show = true;
      let t = setTimeout(() => {
        this.show = false;
        clearTimeout(t);
      }, 2000);
    },
  },
};
</script>

<style scoped>
.msg {
  position: fixed;
  top: 20px;
  left: 50%;
  transform: translateX(-50%);
  background-color: white;
  padding: 10px;
  border-radius: 5px;
  border: 1px solid #e5e5e5;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.3);
  display: flex;
}
.text {
  display: flex;
  align-items: center;
  margin-left: 10px;
}
</style>
