[Answered ]-Vue-for doesn't render objects in html

1👍

Update : After banging my head on the wall, I finally figured out by changing the this into app since it is the main initiator of new vue({})

From this :

 remove_search : function(){
           
            this.search_query = "";
            this.haveresults = false;
        },
        async send_namerequest(){
            const res = await axios.post('/api/search/',{
                client_name : this.search_query,
            })
            .then(function(response){
                this.haveresults = true;
                this.resultsobj = (response.data);
                console.log(resultsobj)
            })
        }
    },

Into this

 remove_search : function(){
           
            app.search_query = "";
            app.haveresults = false;
        },
        send_namerequest : function(){
            axios.post('/api/search/',{
                client_name : app.search_query,
            })
            .then(function(response){
                app.haveresults = true;
                app.resultsobj = response.data;
            })
        }
    },
👤se6

Leave a comment