Vue.js

Both Vue 2 and Vue 3 are supported out of the box by Preview.js.

Since components are rendered in isolation, you may need to set up a custom Wrapper component to set up the required context or Vue plugins.

<!-- __previewjs__/Wrapper.vue -->

<script setup>
  import "../src/styles.css";
  import { getCurrentInstance } from "vue";

  const { appContext } = getCurrentInstance();
  appContext.app.use(mockRouter);
</script>
<template>
  <div class="wrapper">
    <slot />
  </div>
</template>