Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

heykatieben's avatar

Dynamically display updated user stats?

Hi all - I think this is probably simple though I don't know what I'm doing. :)

I added some custom user stats to <spark-navbar>, that display using vue, like this:

@{{ user.money }})

How do I get that display to update when the user object is updated? Things happen in new custom vue components outside this one, and I want to update the user object here so these values will update. How do I do that?

I've tried adding user to mounted() in spark-navbar like this:

Vue.component('spark-navbar', {
    mixins: [base],

    mounted() {
        console.log(Spark.state.user);
    }
});

Thanks!

0 likes
1 reply
heykatieben's avatar

zomg I figured it out!!!

Bus.$emit('updateUser');

Please or to participate in this conversation.