目录
组件的复用


为了解决复用产生的问题,可以进行类型限制

最完整的写法(非常少用)



总结
    
  

 
 总结

 
 
插件允许带参数


总结 scoped
 scoped






 
 
 
 
 
 
父组件监控子组件事件,完成子组件给父组件传递数据


这里第六行,on改once,只执行一次


 
 
 
 
 
 
解绑:可以用$off


 6、、
2、、回调必须在App.vue父组件内



所有都可以找到的--vue

 
 
简写 
 
 在组件里面可以挂载
 
 
总结

在todo中

 
 

 
 总结

 
总结
 
 

 加了appear,在开启网页时就有动画效果
Test.vue
<template>
  <div>
    <button @click="isShow = !isShow">显示/隐藏</button>
    <transition appear>
      <h1 v-show="isShow">你好哇</h1>
    </transition>
  </div>
</template>
<script>
export default {
  name: "Test",
  data() {
    return {
      isShow: true,
    };
  },
};
</script>
<style scoped>
h1 {
  background-color: orange;
}
.v-enter-active {
  animation: yihihi 0.5s linear;
}
.v-leave-active {
  animation: yihihi 0.5s reverse;
}
@keyframes yihihi {
  from {
    transform: translateX(-100%);
  }
  to {
    transform: translateX(0px);
  }
}
</style>
APP.vue
<template>
  <div>
    <Test />
  </div>
</template>
<script>
import Test from "./components/Test";
export default {
  name: "App",
  components: {
    Test,
  },
};
</script>
<style>
</style>

<template>
  <div>
    <button @click="isShow = !isShow">显示/隐藏</button>
    <transition-group name="hello" appear>
      <h1 v-show="isShow" key="1">你好哇</h1>
      <h1 v-show="!isShow" key="2">hhh</h1>
    </transition-group>
  </div>
</template>
<script>
export default {
  name: "Test",
  data() {
    return {
      isShow: true,
    };
  },
};
</script>
<style>
h1 {
  background-color: orange;
}
/* 进入的起点、离开的终点 */
.hello-enter,
.hello-leave-to {
  transform: translateX(-100%);
}
.hello-enter-active,
.hello-leave-active {
  transition: 0.5s linear;
}
.hello-enter-to,
.hello-leave {
  transform: translateX(0);
}
</style>
<template>
  <div>
    <button @click="isShow = !isShow">显示/隐藏</button>
    <transition-group name="hello" appear>
      <h1 v-show="isShow" key="1">你好哇</h1>
      <h1 v-show="!isShow" key="2">hhh</h1>
    </transition-group>
  </div>
</template>
<script>
export default {
  name: "Test",
  data() {
    return {
      isShow: true,
    };
  },
};
</script>
<style>
h1 {
  background-color: orange;
}
/* 进入的起点、离开的终点 */
.hello-enter,
.hello-leave-to {
  transform: translateX(-100%);
}
.hello-enter-active,
.hello-leave-active {
  transition: 0.5s linear;
}
.hello-enter-to,
.hello-leave {
  transform: translateX(0);
}
</style>
 
 
在npm网站中查找animate.css引入

 
<template>
  <div>
    <button @click="isShow = !isShow">显示/隐藏</button>
    <transition-group
      name="animate__animated animate__bounce"
      appear
      enter-active-class="animate__rubberBand"
      leave-active-class="animate__bounceOut"
    >
      <h1 v-show="isShow" key="1">你好哇</h1>
      <h1 v-show="!isShow" key="2">hhh</h1>
    </transition-group>
  </div>
</template>
<script>
import "animate.css";
export default {
  name: "Test",
  data() {
    return {
      isShow: true,
    };
  },
};
</script>
<style>
h1 {
  background-color: orange;
}
/* 进入的起点、离开的终点 */
.hello-enter,
.hello-leave-to {
  transform: translateX(-100%);
}
.hello-enter-active,
.hello-leave-active {
  transition: 0.5s linear;
}
.hello-enter-to,
.hello-leave {
  transform: translateX(0);
}
</style> 

 










