swagger-editor icon indicating copy to clipboard operation
swagger-editor copied to clipboard

Install SwaggerEditor@5 with Vue3

Open marcodarko opened this issue 1 month ago • 0 comments

Is it possible to install SwaggerEditor@5 with Vue3? I see the library exports a React Component, and I can't find any more information on the subject other than the github page.

We currently use v4 running it like this:

<script>
import SwaggerEditorBundle from 'swagger-editor';

export default {
  name: 'Editor',
  data: function () {
    return {
      apiID: '',
      smartStyle: true,
      context: {}
    };
  },
  methods: {
    loadSwaggerEditor: function (myUrl) {
      /* global SwaggerEditorStandalonePreset*/

      const editor = SwaggerEditorBundle({
        url: myUrl,
        dom_id: '#swagger-editor',
        layout: 'StandaloneLayout',
        deeplinking: true,
        presets: [SwaggerEditorStandalonePreset]
      });

      window.editor = editor;

      document
        .querySelector(".topbar a[href$='#']")
        .setAttribute('href', 'https://smart-api.info/registry');
    }
  },
....

</script>

marcodarko avatar Jun 17 '24 21:06 marcodarko