Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
307 views
in Technique[技术] by (71.8m points)

javascript - Vue JS console logging return an Observer

Here how are my datas in the store :

enter image description here

Here my code :

       fetchNotifications() {
            let notifications = {}

            axios.get('/api/unreadNotifications')
                .then(response => {
                    notifications = response.data
                    if(notifications) {
                        this.$store.commit("updateNotifications", notifications)
                    }
                })
                .catch(error => {
                    console.log()
                });
        },
        checkDisplayQuestionnaire() {
            console.log(this.$store.state.notifications)
        },

If i console.log(response.data) in the .then of fetchNotifications(), datas are like this : enter image description here

I tried to use JSON.parse(JSON.stringify(this.$store.state.notifications)) without success.

Anyone have an idea of the problem ? Thanks you.

question from:https://stackoverflow.com/questions/65643257/vue-js-console-logging-return-an-observer

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)
Waitting for answers

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...