1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71
| <script setup lang="ts"> import { ref } from 'vue'; import PageList from './components/PageList.vue'; import axios from 'axios';
const page = 1; const limit = 10; const tableData = ref([]) const total = ref(100)
const tableColumn = [ "name,姓名", "gender,性别", "mobile,手机号码", "county,地址", ]
const buttonlist = [ { text: '新增', emit: 'add', type: 'text' }, { text: '编辑', emit: 'edit', type: 'text' }, { text: '删除', emit: 'del', type: 'text' } ]
async function getLiist(val: object) { const { page: _page, pageSize: _limit } = val const res = await axios.get('http://localhost:3001/userinfo', { params: { _page, _limit, _size: true }, }); tableData.value = res.data total.value = Number(res.headers['x-total-count']) }
getLiist({ page: 1, _limit: 10 })
const getPage = (val: any) => { getLiist(val)
}
function add(scope: any) { console.log(scope.row);
} </script>
<template> <PageList :tableColumn="tableColumn" :buttonlist="buttonlist" :total="200" :tableData="tableData" @getPage="getPage" @add="add"> </PageList> </template>
<style scoped></style>
|