ClientOnly.js 314 B

12345678910
  1. import { ref, onMounted, defineComponent } from 'vue';
  2. export const ClientOnly = defineComponent({
  3. setup(_, { slots }) {
  4. const show = ref(false);
  5. onMounted(() => {
  6. show.value = true;
  7. });
  8. return () => (show.value && slots.default ? slots.default() : null);
  9. }
  10. });