euvl / vue-js-modal

Easy to use, highly customizable Vue.js modal library.
http://vue-js-modal.yev.io
MIT License
4.35k stars 592 forks source link

Cannot read properties of undefined (reading '$modal') #767

Open encoderuz opened 2 years ago

encoderuz commented 2 years ago

Hi there ! I have inexplicable problem.
project: laravel 8 & vue 3 and installed vue-js-modal

yarn add vue-js-modal // installed through this

Problem:

Cannot read properties of undefined (reading '$modal')

import {createApp, inject, ref} from 'vue' 
import routes from './routes'
import store from "./store/store";    
import VModal from 'vue-js-modal'
const app = createApp(App)
.use(routes)
.use(store)
.use(VModal); 
app.config.globalProperties.$modal = VModal; //and I commented this line 
app.mount('#app');

Version:

Vue 3

Example & screenshots:

image

Z3rio commented 2 years ago

I'm also having this issue

parrotsoft commented 2 years ago

I have this problem too, with Vue3 and Laravel 9

Screen Shot 2022-08-09 at 10 53 23 AM

tans27 commented 1 year ago

Anybody fixed this? I have same problem

Andrevoks commented 1 year ago

try to inject VModal in context nuxt(2).js export default function (_, inject) { inject("modal", VModal); } but in context receive this install: ƒ (e,t)

dnnzz commented 1 year ago

Facing same issue too when in production mode , btw in development mode modal works Env : vue-js-modal : 2.0.1 nuxt: 2.15.7

Screenshot_1