Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dont work with NUXT. #37

Open
Cosmat opened this issue May 11, 2019 · 2 comments
Open

Dont work with NUXT. #37

Cosmat opened this issue May 11, 2019 · 2 comments

Comments

@Cosmat
Copy link

Cosmat commented May 11, 2019

Dear creators of Vue-timers! I am a simple hard worker from Russia. I type this message through a Google translator.
I really need your library in my small project. But it does not work under NUXT. As soon as I try to import a vue-timers, the application stops compiling with an error like this:
SyntaxError
Unexpected token export
Please help me figure out how to integrate your library into the NIKST.

@masongzhi
Copy link
Contributor

oh, I will see this issue tomorrow, it has not implemented support for NUXT before.

@masongzhi
Copy link
Contributor

https://nuxtjs.org/guide/plugins#client-side-only

It is important to know that in any Vue instance lifecycle, only beforeCreate and created hooks are called both, from client-side and server-side. All other hooks are called only from the client-side.

because vue-timers use mountedactivateddeactivatedbeforeDestroy hooks, it work only in the browser

nuxt.config.js:

export default {
  plugins: [
    { src: '~/plugins/vue-timers', mode: 'client' }
  ]
}

plugins/vue-timers.js:

import Vue from 'vue'
import VueTimers from 'vue-timers'

Vue.use(VueTimers)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants