farhadnowzari / easy-vue-camera

10 stars 10 forks source link

Install easy vue camera in nuxtjs not working #6

Open CHOMNANP opened 2 years ago

CHOMNANP commented 2 years ago

Anyone manage to this plugin in Nuxtjs?

I have tried install the plugin in nuxtjs, yet I got the error message saying the component is not found in nuxtjs. I have confirmed that the installation and configuration has been done.

farhadnowzari commented 2 years ago

Hello @CHOMNANP are you using nuxt with typescript?

CHOMNANP commented 2 years ago

I am using nuxtjs with javascript.

CHOMNANP commented 2 years ago
image image
farhadnowzari commented 2 years ago

Unfortunately I don't have much nuxt experience but I will try to test it when I got some time

frazaao commented 1 year ago

I implemented this in nuxt, a way that I found to make the component work correctly is add a button toggler to mount the component after the client is in the view, try it.

Note: In the plugins on nuxt.config.js I setted mode: 'client' instead of ssr: false and and set ssr:false in every page that I use the component

Dirdmaster commented 1 year ago

This how I made it work with nuxt:

// plugins/vue-camera.js

import Vue from 'vue'
import EasyCamera from 'easy-vue-camera'

Vue.component('EasyCamera', EasyCamera)
// nuxt.config.js

...

plugins: [
    { src: '~/plugins/vue-camera.js', mode: 'client' }
  ],

...
<!-- pages/camera.vue -->

<template>
  <EasyCamera v-model="picture" />
</template>

...