doqpm82240
2019-07-06 09:33
浏览 340
已采纳

NuxtJs无法读取未定义的属性'_normalized'

this error show when I try to fetch some data in nuxtjs

Cannot read property '_normalized' of undefined

This is my axios request in nuxtjs :

 async asyncData({app}){
        var response = await app.$axios.get('/store/get-services',{params:{id:app.$auth.user.store.id}});
        return {services:response.data.services};
    }

this is a backend controller laravel:

public function store_ads(Request $req){
    if($req->user()->store->id != $req->id){
        abort(403);
    }
    $services = Store::select('id')->with('ads:id,store_id,price,title')->where('id',$req->id)->first();
    return response()->json(['services'=>$services],200);
}

and here is how i fetch them in my template:

<div class="services-list">
                        <h4 class="is-vcentered title has-text-centered has-text-grey-light" v-if="services.ads.length==0">No Services</h4>
                        <ul>
                            <li v-for="service in services.ads" :key="service.id"><nuxt-link>{{service.title}}</nuxt-link></li>
                        </ul>
                    </div>

What is the solution?

  • 写回答
  • 关注问题
  • 收藏
  • 邀请回答

2条回答 默认 最新

  • duanjiao6711 2019-07-06 09:37
    已采纳

    The error was I don't pass to property for <nuxt-link></nuxt-link> and this is what causes this error

    已采纳该答案
    打赏 评论
  • 巴耶克1 2020-07-07 11:20

    也可能是外层div有其他跳转方法,所以就报这个错

    打赏 评论

相关推荐 更多相似问题