Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Install SwaggerEditor@5 with Vue3 #5152

Open
marcodarko opened this issue Jun 17, 2024 · 0 comments
Open

Install SwaggerEditor@5 with Vue3 #5152

marcodarko opened this issue Jun 17, 2024 · 0 comments

Comments

@marcodarko
Copy link

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>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant