11.23 save success complicated json response in vue.js

This commit is contained in:
minseokkang
2022-11-23 18:15:35 +09:00
parent a709acac4b
commit 59d0f6c97d

View File

@@ -23,8 +23,13 @@
</li> </li>
</ul> </ul>
</div> </div>
<div v-for="(article, index) in articles" >
{{article}} : {{index}} <div v-for = "(art,index2) in articles.article">
{{ art }} : {{index2}}
{{art.slug}}
!!
</div>
<!-- <!--
<div class="article-preview"> <div class="article-preview">
@@ -47,7 +52,7 @@
</div> </div>
</div>
<div class="col-md-3"> <div class="col-md-3">
<div class="sidebar"> <div class="sidebar">
@@ -73,15 +78,17 @@
</template> </template>
<script lang="ts"> <script lang="ts">
import {onMounted, reactive} from "vue"; import {onMounted, reactive, ref} from "vue";
import axios from "axios"; import axios from "axios";
export default { export default {
name: "TheHome", name: "TheHome",
setup(){ setup(){
const url = import.meta.env.VITE_BASE_URL; const url = import.meta.env.VITE_BASE_URL;
const articles = reactive({ const articles = reactive({
article:{}, article: {art:{slug: String}},
articlesCount: "",
}) })
onMounted(() => { onMounted(() => {
@@ -89,7 +96,10 @@ export default {
.then(response => { .then(response => {
console.log(response); console.log(response);
articles.article = response.data.articles; articles.article = response.data.articles;
console.log(articles.article); articles.articlesCount = response.data.articlesCount;
articles.article = JSON.parse(JSON.stringify(articles.article));
console.log(typeof(articles.article));
console.log(articles.articlesCount);
}); });
}) })