Get Even More Visitors To Your Blog, Upgrade To A Business Listing >>

SOLVED: reset the star-rating component, VUE JS

Hashaam Ahmed:

I am using star-rating plugin in vue js, and I am using v-model to show the ratings from db. Everything works fine as when user is not Logged in and he/she tries to rate it shows an Error "login to rate", but the stars dont reset to db value instead it shows the rating of not logged in user. Currently after the error msg I am refreshing the whole page. Is there a simple way to reset the stars instead of refreshing the whole page?

:show-rating="false" @rating-selected="setRating" v-model="rating"

above is the start rating and while clicking it calls a function where I am checking if user is logged in or not with an api call. Thanks in advance.

setRating: function (rating) {

axios.get('/checkuser').then(response => {

this.user =;

if (this.user === "Logout") {
toastr.error('Please login to rate', 'Error', {
positionClass: 'toast-bottom-right'
window.location = "/menu/" + this.menu_id;
} else {
// save in to db

}).catch(error => {

// TODO: Handle error


Posted in S.E.F
via StackOverflow & StackExchange Atomic Web Robots

This post first appeared on Stack Solved, please read the originial post: here

Share the post

SOLVED: reset the star-rating component, VUE JS


Subscribe to Stack Solved

Get updates delivered right to your inbox!

Thank you for your subscription