DEV Community

Aaron Gong
Aaron Gong

Posted on

Redoc With VueJS

Here is a very short post on using Redoc in VueJS.

Below is a component you can use in any VueJS project. Remember to install redoc and null dependencies.

<template>
  <h2>Redoc Sample</h2>
  <div id="redoc-container"></div>
</template>

<script setup>
// npm install redoc
// npm install null
import * as redoc from 'redoc/bundles/redoc.standalone' // requires null package
import { onMounted } from 'vue'

onMounted(() => {
  redoc.init('http://petstore.swagger.io/v2/swagger.json', { "expandResponses": "200,400" }, document.getElementById('redoc-container'))
})
</script>

<style scoped>
</style>
Enter fullscreen mode Exit fullscreen mode

That's all.

Top comments (0)

Billboard image

The Next Generation Developer Platform

Coherence is the first Platform-as-a-Service you can control. Unlike "black-box" platforms that are opinionated about the infra you can deploy, Coherence is powered by CNC, the open-source IaC framework, which offers limitless customization.

Learn more

👋 Kindness is contagious

Please leave a ❤️ or a friendly comment on this post if you found it helpful!

Okay