Uncaught SyntaxError: Illegal return statement in framework 7

return {
methods: {
next_btn: function () {

    alert(test);
    localStorage.setItem("first_user", "yes");
    mainView.router.navigate({ name: 'login-signup' });
  },
},

}

here I’m getting a error on @click function ( Illegal return statement )

Покажите минимальный пример на jsfiddle

к сожалению, я не достал вас

Show a minimal code on jsfiddle

Where did you put that code and how to load it?

I put that code in my index.html page

The code example you have posted can be used only in single file page components in routes loaded with componentUrl https://framework7.io/docs/router-component.html#single-file-component