AdaKing88
2023-08-23 9cad48db6c56c3e2796a9d6da881817ef13b6eca
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
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
<template>
  <el-form :inline="true" :model="formInline" class="demo-form-inline">
    <el-form-item label="选择列表">
      <el-select v-model="formInline.region" class="m-2" placeholder="Select">
        <el-option
          v-for="item in options"
          :key="item.value"
          :label="item.label"
          :value="item.value"
        />
      </el-select>
    </el-form-item>
    <el-form-item>
      <el-button type="primary" @click="onSubmit">Query</el-button>
    </el-form-item>
  </el-form>
  <el-table :data="tableData" style="width: 100%">
    <el-table-column prop="date" label="Date" />
    <el-table-column prop="name" label="Name" />
    <el-table-column prop="address" label="Address" />
    <el-table-column label="操作">
      <template #default="scope">
        <el-button size="small" @click="details(scope.$index)"
          >查看详情</el-button
        >
      </template>
    </el-table-column>
  </el-table>
  <div class="page">
    <el-pagination
      background
      layout="prev, pager, next"
      :page-count="pageData.total"
      :current-page="pageData.ListData.pageNo"
      @current-change="handleCurrentChange"
    />
  </div>
</template>
 
<script>
import { ref, reactive, onMounted } from "vue";
export default {
  name: "NewsIndex",
  components: {},
  props: {},
  setup(props) {
    const value = ref("");
    const tableData = reactive([]);
    let pageData = reactive({
      ListData: {
        pageNo: 1,
        pageSize: 10,
      },
      total: 0,
    });
    const options = [
      {
        value: "Option1",
        label: "Option1",
      },
      {
        value: "Option2",
        label: "Option2",
      },
      {
        value: "Option3",
        label: "Option3",
      },
      {
        value: "Option4",
        label: "Option4",
      },
      {
        value: "Option5",
        label: "Option5",
      },
    ];
    const formInline = reactive({
      region: "",
    });
    //确定搜索动作
    const onSubmit = () => {};
    //请求列表方法
    const getlistData = () => {
      //计算分页数量
      //  pageData.total = Math.ceil(data.data.total / pageData.ListData.pageSize)
    };
    // 分页器
    const handleCurrentChange = (val) => {
      pageData.ListData.pageNo = val;
 
      getlistData();
    };
    //查看详情按钮
    const details = (val) => {};
    return {
      value,
      pageData,
      options,
      onSubmit,
      formInline,
      tableData,
      handleCurrentChange,
      details,
    };
  },
};
</script>
<style lang="scss" scoped>
.page {
  display: flex;
  justify-content: flex-end;
  margin-top: 20px;
}
</style>