Home

Issue: 1806

How can I access to the plugin methods in page component

[issue link]

Hi there from a newbie,
I’m having a problem when trying to use vue-js-modal.

plugins/modals.js

import Vue from 'vue'
import VModal from 'vue-js-modal'

Vue.use(VModal)

nuxt.config.js

build: {
  vendor: ['vue-js-modal']
},
plugins: [
  { src: '~/plugins/modal.js', ssr: false}
]

According to the plugin writer, the syntax this.$modal is available. But when I tried to use in in nuxt page (pages/*.vue) object this.$modal return an undefined.
I tried console.log(this) a find out in scope of an page, this is not Vue object, i got some thing like this.
image

On browser console, I found modal object in window.$nuxt.$modal
image

How can I use plugins like vue-js-modal in a page. I looked through the document many times but couldn’t find the answer.

I’m building a static web running on client side.

This question is available on Nuxt.js community (#c1621)