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

this.$nuxt.refresh not recognized while using property decorator #485

Open
karimennassiri opened this issue Feb 9, 2021 · 1 comment
Open

Comments

@karimennassiri
Copy link

Describe the bug
I'm usingnuxt-property-decorator and vue-property-decorator to import elements such Vue, Component, Model, ect into my project. I chose to develop usingClass-Based Component .
Inside a page (Home), I created a method that allows to perform an operation followed by a page refresh using this.$nuxt.refresh() I manage to refresh the page, however I have a warning that tells me that my instruction is not recognized.
`Property '$nuxt' does not exist on type 'Home'.
I exactly followed what is here : https://typescript.nuxtjs.org/guide/setup to install my Nuxt project with TS. The problem remains the same.

To Reproduce
PS: the code has been clipped to keep the important part

<script lang="ts">
import { Component, Vue } from 'nuxt-property-decorator'
import { manager } from '../services/manager'

@Component({})
export default class Home extends Vue {
  services!: Array
  async asyncData() {
    const services = await manger.get()
    return { services }
  }

  ....

  /**
   * Change results order
   * @param value {string}
   * @returns {void}
   */
  refreshResults(value: string): void {
    // Setting the new ranking value
    manager.setSettings(`${value}(name)`)
    // refreshing page
    this.$nuxt.refresh()
  }
}

Expected behavior
this.$nuxt.refresh() to be recognized

Screenshots
https://i.stack.imgur.com/c7nlJ.png

@karimennassiri karimennassiri changed the title this.$nuxt.refresh not recognized while usin property decorator this.$nuxt.refresh not recognized while using property decorator Feb 9, 2021
@kevinmarrec
Copy link
Contributor

@karimennassiri Could you provide a repository with the mentioned issue ? I'll be glad to help then :)
If it's private you can send me a read-only access and revoke afterwards when I've found a solution.

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