Static GitHub Issues

[1806] How can I access to the plugin methods in page component

prev: Nuxt generate: Missing first item in v-for loop
next: Using axios globally

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.

<!--cmty--><!--cmty_prevent_hook--><div align="right"><sub><em>This question is available on <a href="https://nuxtjs.cmty.io">Nuxt.js</a> community (<a href="https://nuxtjs.cmty.io/nuxt/nuxt.js/issues/c1621">#c1621</a>)</em></sub></div>