не могу распарсить на Vue js
Доброе время суток , не могу никак роспарсить в фале App.vue json мне надо роспарсить і отобразить первих 10 картинок , не понимаю что я делаю не так зарание спс
<template>
<div id="app">
<div class="get " v-for="get in gets" :key="get.id">
<div>{{gets.raw}}</div>
</div>
</div>
</template>
<script>
export default {
name: "app",
data() {
return {
gets: []
};
},
async mounted() {
const res = await fetch
("https://api.unsplash.com/search/photos?query=london&client_id=7KOSBgto5zitVK6UfxHhkCTSLZ8zdBMrHUZZ-Ofedws");
const gets = await res.json();
this.gets = gets;
}
};
</script>
<style>
#app {
font-family: Avenir, Helvetica, Arial, sans-serif;
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
text-align: center;
color: #2c3e50;
margin: 50px auto;
width: 80vw;
}
</style>
|
Посмотрите структуру json, результаты находятся в узле «results».
this.gets = gets.results; |
я переписал всеоровно ошибка
error Unexpected newline between function and ( of function call no-unexpected-multiline
<template>
<div id="app">
<div class="get" v-for="get in gets" :key="get.id">
<div>{{gets.result}}</div>
</div>
</div>
</template>
<script>
export default {
name: "app",
data() {
return {
gets: []
};
},
async mounted() {
const res = await fetch
("https://api.unsplash.com/search/photos?query=london&client_id=7KOSBgto5zitVK6UfxHhkCTSLZ8zdBMrHUZZ-Ofedws");
const gets = await res.json();
this.gets = gets.results;
}
};
</script>
<style>
#app {
font-family: Avenir, Helvetica, Arial, sans-serif;
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
text-align: center;
color: #2c3e50;
margin: 50px auto;
width: 80vw;
}
</style>
|
https://codepen.io/brianhaferkamp/pen/ZwrEvr#_=_ я нашол похоже но не могу перенести на вю так как тока начал изучать
|
misha.korolcov, у вас в 4 и 22-23 строках ошибки.
Читайте документацию vue: https://ru.vuejs.org/v2/guide/list.html Для перевода текста ошибки можно использовать любой переводчик, например: http://translate.google.ru/ |
спс
|
| Часовой пояс GMT +3, время: 12:19. |