Search code examples
vuejs3vue-script-setup

Is there a way to break/return from Vue3 `<script setup>`?


Is there a way to break/return from Vue3 <script setup>?

<script setup lang="ts">
  // code is not working, for illustration purpose
  if (!process.client) return

  // do something...
  const count = ref(0)
</script>

Solution

  • I used <ClientOnly> tag in nuxt 3 recently, when I needed to hide a logic from ssr. Maybe this idea will help you somehow

    <ClientOnly>
      <ComplexComponentWithLogic />
    </ClientOnly>