为什么在Nuxt / Vue中获得不同的远程地址?

时间:2018-06-27 11:10:18

标签: javascript vue.js http-headers axios nuxt.js

为什么我要使用其他远程地址?在我的mount()方法上,我有this.fetchFeaturedArtistsData(),即:

fetchFeaturedArtistsData() {
  this.featuredArtists.forEach(artist => {
    this.getSongs(artist.name)
      .then((r) => {
        this.featuredArtists[this.featuredArtists.indexOf(artist)].songs = r.data.results
      })
      .catch((e) => {
        console.log(e)
      })
  })
},

以及我的searchArtist方法上

searchArtist: debounce(function() {
  this.loading = true
  this.$axios.get('https://itunes.apple.com/search?term=' + this.$store.state.search)
    .then((r) => {
      this.searchResult = r.data
    })
    .catch((e) => {
      return e
    })
    .finally(() => {
      this.loading = false
    })
}, 1000)

我希望这两种方法都具有相同的标题。请检查所附的照片。

这是我的fetchFeaturedArtistsData()方法 This is my <code>fetchFeaturedArtistsData()</code> method

这是我的searchArtist方法的标题 enter image description here

0 个答案:

没有答案
相关问题