0
点赞
收藏
分享

微信扫一扫

uniapp 微信小程序 vue3.0+TS手写自定义封装步骤条(setup)

无愠色 2023-10-13 阅读 93

简述版

前端

<div id=Zjw>
<table>
<tr v-for="item in all">
                        <td>{{item.cno}}</td>
                        <td>{{item.name}}</td>
                        <td>{{item.age}}</td>
                        <td><img :src="item.picUrl" style="height: 130px;width: 130px"></td>
                    </tr>
</table>
</div>
 new Vue({
        el: "#Zjw",
        data:{
            all: []
        },
        mounted() {
            this.getAl()
            //回调
            //Cqnu-zjw
        },
        methods: {
            getAl(){
                //使用axios请求后台数据
                axios.get("http://localhost:8081/getAll").//getAll后端接口
                then(res => {
                    this.all = res.data
                }).catch(err => {
                    console.log("获取不正常")
                })
            }
        },
    })

后端

@ResponseBody
    @GetMapping("getAll")
    public List<Student> stu(Model model) {
        List<Student> students = stuService.getAll();
        return students;
    }
举报

相关推荐

0 条评论