为什么我跟着一步一步做,但是最后数据还是没有显示在页面上呀?

来源:5-3 Vue3数据绑定显示列表数据

慕粉0105314807

2024-12-23

图片描述

写回答

1回答

慕粉0105314807

提问者

2024-12-23

<pre>
     {{ ebooks}}
    </pre>

  </a-layout-content>
  </a-layout>
</template>

<script lang="ts">
import { defineComponent ,onMounted,ref,reactive,toRef} from 'vue';
import HelloWorld from '@/components/HelloWorld.vue'; // @ is an alias to /src
import axios from 'axios';
export default defineComponent({
  name: 'Home',
  components: {
    HelloWorld,
  },
  setup(){
    console.log("setup");
    const ebooks = ref();
    onMounted(()=>{
       console.log("onMounted");
      axios.get("GET http://localhost:8888/ebook/list?name=Boot").then((response)=>{
        const data =response.data;
       ebooks.value= data.content;
        console.log(response);
      });

    });
return{
      ebooks
}
  }
});
</script>


0
2
慕粉0105314807
回复
甲蛙
对的,前端没有任何输出
2024-12-30
共2条回复

Spring Boot+Vue3前后端分离,实战wiki知识库系统

一课掌握前后端最火框架,更有职场竞争力

2530 学习 · 1674 问题

查看课程