<template>
<br />
    <div>
        <h3>게시판</h3><hr />
        <el-table :data="items" size="mini" style="width: 100%;">
            <el-table-column type="index" width="50" />
            <el-table-column prop="id" label="아이디" width="180" />
            <el-table-column prop="name" label="이름" width="180" />
            <el-table-column prop="tel" label="전화번호" width="180" />
            <el-table-column prop="email" label="이메일" width="180" />
        </el-table>
            <div class="block">
                <el-pagination layout="prev, pager, next" :total="50" @click="handleBoard(tmp)"></el-pagination>
            </div>
        <table border="1">
            <thead>
                <tr>
                    <th>번호</th>
                    <th>아이디</th>
                    <th>이름</th>
                    <th>전화번호</th>
                    <th>이메일</th>
                </tr>
            </thead>
            <tbody> 
                <tr v-for="(tmp, idx) in items" v-bind:key="tmp">
                    <td>{{(idx + 1)}}</td> 
                    <td>{{tmp.id}}</td>
                    <td>{{tmp.name}}</td>
                    <td>{{tmp.tel}}</td>
                    <td v-text="tmp.email"></td>
                </tr>
            </tbody>
        </table>
        <br />
        <div>
            <label v-for="tmp in pages" v-bind:key="tmp">
                <button @click="handleBoard(tmp)">{{ tmp }}</button>
            </label>
        </div>
    </div>
</template>
<script>
    export default {
        
        created() { 
            console.log('1. created');
            this.handleBoard(1); 
        },
        
        
        
        
        
        data() {
            return {
                pages : 5,
                items : [],
            }
        },
        
        methods: {
            handleBoard(page) { 
                console.log('handleBoard', page);
                
                this.items = [
                    {id:'a', name:'가', tel:'010', email:'a@a.com'},
                    {id:'b', name:'나', tel:'011', email:'b@a.com'},
                    {id:'c', name:'다', tel:'012', email:'c@a.com'}
                ]
            }
        }
    }
</script>
<style scoped>
    @import '../assets/css/mystyle1.css';
</style>