在线观看不卡亚洲电影_亚洲妓女99综合网_91青青青亚洲娱乐在线观看_日韩无码高清综合久久

鍍金池/ 問答/Java  HTML/ vue獲取json結(jié)果undefined

vue獲取json結(jié)果undefined

我定義了一個(gè)myCollection.json文件

{
    
    "collection":[
      {
          "user_name":"超級無敵abc",
          "user_image_URL":"../assets/myCollection/user1.jpg",
          "goods_image_URL":[
                 "../assets/myCollection/user1.1.jpg",
                 "../assets/myCollection/user1.2.jpg",
                 "../assets/myCollection/user1.3.jpg",
                 "../assets/myCollection/user1.4.jpg",
          ],
          "goods_price":"1000",
          "title":"跳樓清倉大甩賣",
          "collect_state":true
      },
      {
          "user_name":"我的名字就是無敵無敵無敵無敵無敵長",
          "user_image_URL":"../assets/myCollection/user2.jpg",
          "goods_image_URL":[
               "../assets/myCollection/user2.1.jpg",
          ],
          "goods_price":"24.5",
          "title":"大學(xué)物理",
          "collect_state":true
      },
      {
          "user_name":"短",
          "user_image_URL":"../assets/myCollection/user3.jpg",
          "goods_image_URL":[

          ],
          "goods_price":"50",
          "title":"辣雞Java低價(jià)出售",
          "collect_state":true
      }
  ]
}

然后我用axios獲取json文件

this.$http.get('http://localhost:8081/static/json/myCollection.json').then(

            function(response){
                   console.log(response.data);
                },
            function(response){
                alert("連接json文件失敗");
            });//axio

如果是console.log(response.data);可以打印出json文件,可是console.log(response.data.collection);的話就會輸出undefined。請問要怎么解決

回答
編輯回答
我以為

clipboard.png

2017年12月26日 18:52
編輯回答
薔薇花

我也遇到同樣的問題,我的JSON是沒錯(cuò)誤的。請問最后是如何解決的啊?

2018年4月10日 04:26