handleChangeViewA.js 3.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  1. Vue.component('comA',{
  2. template:'<div class="tab1">\
  3. <template>\
  4. <span class="span">一周就医次数>=3次的患者记录</span>\
  5. <el-table :data="tableData" border style="width: 100%" :data.native="tableData.slice((currentPage-1)*pagesize,currentPage*pagesize)">\
  6. <el-table-column prop="name" label="姓名" width="140">\
  7. </el-table-column>\
  8. <el-table-column prop="province" label="就医次数" width="140">\
  9. </el-table-column>\
  10. <el-table-column prop="address" label="身份证号" width="380">\
  11. </el-table-column>\
  12. <el-table-column prop="province" label="性别" width="140">\
  13. </el-table-column>\
  14. <el-table-column prop="province" label="年龄" width="140">\
  15. </el-table-column>\
  16. <el-table-column prop="address" label="地址" width="380">\
  17. </el-table-column>\
  18. <el-table-column fixed="right" label="操作" width="140">\
  19. <template slot-scope="scope">\
  20. <el-button @click="handleClick(scope.row)" type="text" size="small">查看详情</el-button>\
  21. </template>\
  22. </el-table-column>\
  23. </el-table>\
  24. <el-pagination @size-change="handleSizeChange" @current-change="handleCurrentChange" :current-page="currentPage"\
  25. :page-sizes="[2,10, 20, 40]" :page-size="pagesize" layout="total,sizes,prev, pager, next, jumper"\
  26. :total="tableData.length">\
  27. </el-pagination>\
  28. </template>\
  29. </div> ',
  30. data:function(){
  31. return{
  32. currentPage: 1, //初始页
  33. pagesize:2, // 每页的数据
  34. tableData: [{
  35. date: '2016-05-03',
  36. name: '王小虎',
  37. province: '上海',
  38. city: '普陀区',
  39. address: '上海市普陀区金沙江路 1518 弄',
  40. zip: 200333
  41. }, {
  42. date: '2016-05-02',
  43. name: '王小虎',
  44. province: '上海',
  45. city: '普陀区',
  46. address: '上海市普陀区金沙江路 1518 弄',
  47. zip: 200333
  48. }, {
  49. date: '2016-05-04',
  50. name: '王小虎',
  51. province: '上海',
  52. city: '普陀区',
  53. address: '上海市普陀区金沙江路 1518 弄',
  54. zip: 200333
  55. }, {
  56. date: '2016-05-01',
  57. name: '王小虎',
  58. province: '上海',
  59. city: '普陀区',
  60. address: '上海市普陀区金沙江路 1518 弄',
  61. zip: 200333
  62. }],
  63. }
  64. },
  65. methods: {
  66. handleSizeChange: function (size) {
  67. this.pagesize = size;
  68. console.log(this.pagesize) //每页下拉显示数据
  69. },
  70. handleCurrentChange: function (currentPage) {
  71. this.currentPage = currentPage;
  72. console.log(this.currentPage) //点击第几页
  73. },
  74. handleClick(row) {
  75. console.log(row);
  76. }
  77. }
  78. })