javascript - 请问getPost()是什么方法,有出处吗?
大家讲道理
大家讲道理 2017-04-11 12:02:04
0
1
516

在vue-router文档数据获取一章的时候,有一段代码展示了再导航完成之后获取数据,其中使用了getPost()方法,查了一下没找到这个方法,有人知道吗?

methods: {
    fetchData () {
      this.error = this.post = null
      this.loading = true
      // replace getPost with your data fetching util / API wrapper
      getPost(this.$route.params.id, (err, post) => {
        this.loading = false
        if (err) {
          this.error = err.toString()
        } else {
          this.post = post
        }
      })
    }
  }

原文并不长,只有三段话,可以看看原文vue-router:数据获取

大家讲道理
大家讲道理

光阴似箭催人老,日月如移越少年。

reply all(1)
小葫芦

看上边那句注释:

// replace getPost with your data fetching util / API wrapper

(用的时候)替换getPost为你自己的数据fetching工具或者API

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!