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

Not working properly with NUXT #21

Open
mapimagdich opened this issue Jul 24, 2019 · 2 comments
Open

Not working properly with NUXT #21

mapimagdich opened this issue Jul 24, 2019 · 2 comments

Comments

@mapimagdich
Copy link

Hello,
finally I got it working with NUXT but theres a problem if I reload the page OR I access the subpage with the chart directly. Then the whole application crashes and I get error 'define is not defined'.
I run nuxt in universal mode:
grafik

plugins/vue-morris.js

import Raphael from 'raphael/raphael'
import jQuery from 'jquery'

// This is needed by Morris
global.Raphael = Raphael
global.jQuery = jQuery

nuxt-config.js

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

chartSection.vue

<template>
<line-chart>....</line-chart>
</template>

<script>
import { LineChart } from 'vue-morris'
import axios from "axios"

export default {
  data() {
    return {
      ....
    };
  },
  components: {
    LineChart
  }
..

I already found these links, but could not get it work
https://nuxtjs.org/guide/plugins#only-for-browsers
https://nuxtjs.org/faq/window-document-undefined/
https://github.com/nuxt/nuxt.js/issues/30

Thank you for your help!

@bbonnin
Copy link
Owner

bbonnin commented Jul 24, 2019

Hi,
I have written a short article about that integration: https://medium.com/@brunobonnin/building-a-simple-app-with-nuxt-and-morris-js-for-displaying-chart-b6b33b14ffff

Maybe it could help you. Let me know.

@mapimagdich
Copy link
Author

mapimagdich commented Jul 24, 2019

Hi,
I have written a short article about that integration: https://medium.com/@brunobonnin/building-a-simple-app-with-nuxt-and-morris-js-for-displaying-chart-b6b33b14ffff

Maybe it could help you. Let me know.

Thank your for your reply. I followed your tutorial from the beginning (it was the only article about nuxtjs and morrisjs in the internet ;) ) and the error came up.

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