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

Usage example for nuxtjs ? #29

Closed
LittleLama opened this issue Oct 2, 2024 · 1 comment
Closed

Usage example for nuxtjs ? #29

LittleLama opened this issue Oct 2, 2024 · 1 comment

Comments

@LittleLama
Copy link

LittleLama commented Oct 2, 2024

Describe the bug
I can't make it work with Nuxtjs

To Reproduce
Steps to reproduce the behavior:

  1. Install a nuxt js
  2. Make a plugin with these lines in it
import JsonExcel from "vue-json-excel3"
import { defineNuxtPlugin } from '#app';

export default defineNuxtPlugin(nuxtApp => {
  nuxtApp.vueApp.component('downloadExcel', JsonExcel);
});
  1. Make a page/component with
    <downloadexcel :data="exportData" name="Test">Download</downloadexcel>
  2. See if you see any error, mine won't throw any error, load depencies, but won't display

Expected behavior
To load correctly the page, display the Download link, and download

Git link to reproduce the issue
https://codesandbox.io/p/devbox/nuxt-json-excel3-2hs3l6

Desktop (please complete the following information):

  • OS: Nuxt 3.11.2
@pratik227
Copy link
Owner

pratik227 commented Jan 20, 2025

Hi @LittleLama,

I tried on local it's working for me.

<script setup lang="ts">
const route = useRoute()
import JsonExcel from "vue-json-excel3"

const exportData = [
  {
    name: "Johson",
    data: "developer",
    salary: 2000,
    age: 28
  },
  {
    name: "Monika",
    data: "designer",
    salary: 2500,
    age: 23
  },
  {
    name: "John",
    data: "developer",
    salary: 2000,
    age: 28
  },
  {
    name: "Monika",
    data: "designer",
    salary: 2500,
    age: 23
  }
]
</script>

<template>
  <div>
    <h1>Nuxt Routing set up successfully!</h1>
    <p>Current route: {{ route.path }}</p>

    <JsonExcel :data="exportData" name="Test">Download</JsonExcel>

  </div>
</template>

{
  "name": "nuxt-app",
  "private": true,
  "type": "module",
  "scripts": {
    "build": "nuxt build",
    "dev": "nuxt dev",
    "generate": "nuxt generate",
    "preview": "nuxt preview",
    "postinstall": "nuxt prepare"
  },
  "dependencies": {
    "nuxt": "^3.15.2",
    "vue": "latest",
    "vue-json-excel3": "^1.0.30",
    "vue-router": "latest"
  }
}

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