so1ve / vue-skinview3d

Three.js powered Minecraft skin viewer. (Vue binding of skinview3d)
https://vue-skinview3d.mk1.io
MIT License
10 stars 2 forks source link

How to use with Nuxt? #53

Closed InstantlyMoist closed 9 months ago

InstantlyMoist commented 9 months ago

Hi there,

I was wondering if this is usable with Nuxt?

Kind regards

so1ve commented 9 months ago

It should! If not, please provide a reproduction repo to help me debug. Thanks!

InstantlyMoist commented 9 months ago

Could you hook me up with an example? Im very new to Nuxt so I'm having a hard time figuring out how I should add it.

I attempted creating a Nuxt plugin and using doing Vue.useComponent(SkinRender3d) but it didn't seem like a working or the right solution.

InstantlyMoist commented 9 months ago

I created a plugin like this: `import Vue from 'vue'; import { SkinView3d } from 'vue-skinview3d/index';

Vue.component('SkinView3d', SkinView3d);`

then imported it like this: plugins: [ "~/plugins/skinrender3d.ts", ],

and attempted to use it like this (https://pastebin.com/KaE9gc0w)

InstantlyMoist commented 9 months ago

Managed to find the issue, seems to be working great. Thanks

so1ve commented 9 months ago

You don't have to register a global component, just import it and use in the template:

<script lang="ts">
import { SkinView3d } from "vue-skinview3d";

export default {
  props: {
    skin_url: {
      type: Object,
      default: null
    },
    name: {
      type: String,
      default: null
    },
    description: {
      type: String,
      default: null
    },
  },
  components: {
    SkinView3d,
  },
};
</script>

<template>
  <SkinView3d />
</template>
github-actions[bot] commented 8 months ago

This issue has been locked since it has been closed for more than 14 days.

If you have found a concrete bug or regression related to it, please open a new issue. If you have any other comments you should create a new discussion.