Vue3的生命周期的父组件.vue 512 B

123456789101112131415161718192021222324252627
  1. <!-- eslint-disable vue/multi-word-component-names -->
  2. <script setup lang="ts">
  3. import TheWelcome from './components/props的使用.vue'; // 确保路径正确
  4. import { ref, onMounted} from "vue";
  5. let lisShow = ref(true)
  6. // 挂载完成
  7. onMounted(() => {
  8. console.log("挂载完成");
  9. });
  10. </script>
  11. <template>
  12. <div class="app">
  13. <TheWelcome v-if="isShow" />
  14. </div>
  15. </template>
  16. <style scoped>
  17. .app {
  18. background-color: #ddd;
  19. box-shadow: 0 0 10px;
  20. border-radius: 10px;
  21. padding: 20px;
  22. }
  23. </style>