Static GitHub Issues

[2388] In 'head(){}' can't use the data which get the dynamic request

prev: Big gods, how do you configure Axios in the nuxt?(大神们,怎么在nuxt中全局配置axios啊?)
next: Global component that exists app wide regardless of layout

My code as follow:

<script>
  // import axios from 'axios'
  var rapaxios = require('rap-axios-plugin')
  export default {
    data () {
      return {
        title: 'test',
        staticD: { // 静态数据
          wait: false,
          fade: ''
        },
        dynamicD: { // 动态请求数据后覆盖此处的默认数据
          'curpath': '/',
          'gotopimg': '/img/i-top.png',
          'logosrc': '/img/logo.png',
          'nav': [
            { 'curpath': '/', 'txt': '首页' },
            { 'curpath': '/cases', 'txt': '案例' },
            { 'curpath': '/designers', 'txt': '设计师' },
            { 'curpath': '/properties', 'txt': '热装楼盘' },
            { 'curpath': '/constructions', 'txt': '在施工地' },
            { 'curpath': '/embodiments', 'txt': '别墅实施' },
            { 'curpath': '/furnishings', 'txt': '别墅软装' },
            { 'curpath': '/villas', 'txt': '出版刊物' },
            { 'curpath': '/about', 'txt': '关于' }
          ],
          'rootdir': '/',
          'tel': '400-001-5821',
          'telimg': '/img/tel.png'
        }
      }
    },
    head () {
      return {
        title: this.title
        meta: this.statsCode.meta
        // link: [],
        // script: this.statsCode
      }
    },
    created () {
      // console.log(this)
      this.fetchData()
      // this.pathfn() // 渲染dom前调用导航定位(异步在这写不起作用,写在fetchData方法里面)
    },
    methods: {
      fetchData: function () {
        console.log('开始请求数据......')
        let that = this
        // 配置projectId,使用前最好先配置config
        rapaxios.config({
          rootUrl: 'http://rap.taobao.org',
          mock: 'mockjsdata',
          projectId: '30077',
          ismock: false
        })
        rapaxios
          .get('api/default')
          .then(function (res) {
            that.dynamicD = res.data
            console.log(res.data)
            that.pathfn() // 渲染dom前调用导航定位
            console.log('请求数据完成......')
          })
          .catch(function (err) {
            console.log(err)
          })
      }
    }
  }
</script>

and it's error,

TypeError: Cannot read property 'meta' of undefined at VueComponent.head (default.vue:77)

but I use axios request url(http://rap.taobao.org/mockjsdata/30077/api/default) and console.log(data),its exit the statsCode object

that is to say,in head(){} can't use 'statsCode' from data() which dynamic request,why???

who can help me,please!

<!--cmty--><!--cmty_prevent_hook--><div align="right"><sub><em>This question is available on <a href="https://nuxtjs.cmty.io">Nuxt.js</a> community (<a href="https://nuxtjs.cmty.io/nuxt/nuxt.js/issues/c2073">#c2073</a>)</em></sub></div>