[Vuejs]-Vue js in laravel..Computed method is undefined

0👍

you guys just look at my methods and vue component…But the actual problem was in my controller where…

$about = About::where('publication_status',1)->orderBy('id','ASC')->take(1)->first();
return response()->json(['about',$about],200);

to

$about = About::where('publication_status',1)->orderBy('id','ASC')->take(1)->first();
return response()->json(['about'=>$about],200);

0👍

You are accessing the computed property using about, but the computed property is defined as About.

JavaScript is case sensitive.

0👍

First it is a typo change this About() to thisabout() . it is because vuejs is case sensitive.
Second as you are geting about in array type you need to loop through it to get the data of each column so try this

<div v-for="abt in about" :key="abt.id"class="heading-block border-bottom-0 mb-0">
                                <h2 class="nott font-weight-semibold mb-4 text-secondary" style="color: #1ABC9C;">Our Story</h2>
                                <p v-if="about">{{abt.about_us}}</p>

Leave a comment