【Vue】路由组件中失去焦点和获得焦点的两个事件

<template>
  <div class="m_box">
    {
   
   { id }}.{
   
   { name }}
    <br />
    <input type="text" />
  </div>
</template>

<script>
export default {
  name: "Menu_1",
  props: ["id", "name"],
  mounted() {
    console.log("=============");
    console.log(this);
  },
  activated() {
    alert("进来了");
  },

  deactivated() {
    alert("离开了");
  },
};
</script>

<style scoped>
.m_box {
  width: 95%;
  height: 68px;
  border: 1px rgb(253, 211, 211) solid;
  margin-top: 5px;
  text-align: center;
  line-height: 28px;
  overflow: hidden;
  background-color: rgb(248, 248, 248);
}
</style>

猜你喜欢

转载自blog.csdn.net/dxnn520/article/details/125165377