22.前端页面的基本模板

<template>
    <div class="app-container">
        {{list}}
    </div>
</template>

<script>
import teacher from '@/api/teacher/teacher.js';

export default {
    data() { // 初始化数据
        return {
            list: null
        }
    },
    created() { // 初始化方法
        this.getList();
    },
    methods: {
        getList() { // 自定义方法
            teacher.getList()
                .then(response => {
                    console.log(response);
                    this.list = response;
                })
                .catch(error => {

                });
        }
    }
}
</script>
发布了253 篇原创文章 · 获赞 10 · 访问量 1万+

猜你喜欢

转载自blog.csdn.net/gunsmoke/article/details/105439986