有没有办法从 Vue3 `<script setup>` 中断/返回?

And*_*See 7 vuejs3 vue-script-setup

有没有办法从 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>
Run Code Online (Sandbox Code Playgroud)

Leo*_*vab 1

<ClientOnly>最近,当我需要向 ssr 隐藏逻辑时,我在 nuxt 3 中使用了标签。也许这个想法会对你有所帮助

<ClientOnly>
  <ComplexComponentWithLogic />
</ClientOnly>
Run Code Online (Sandbox Code Playgroud)