guhongwei 2 лет назад
Родитель
Сommit
05f2168200
1 измененных файлов с 53 добавлено и 0 удалено
  1. 53 0
      src/components/frame/c-page.vue

+ 53 - 0
src/components/frame/c-page.vue

@@ -0,0 +1,53 @@
+<template>
+  <div id="c-page">
+    <el-pagination
+      background
+      layout="total, prev, pager, next"
+      :page-sizes="[10, 50, 100, 150, 200]"
+      :total="total"
+      :page-size="limit"
+      :current-page.sync="currentPage"
+      @current-change="changePage"
+    >
+    </el-pagination>
+  </div>
+</template>
+
+<script>
+import { mapState, createNamespacedHelpers } from 'vuex';
+export default {
+  name: 'c-page',
+  props: {
+    total: { type: Number },
+    limit: { type: Number, default: 10 },
+  },
+  components: {},
+  data: function () {
+    return {
+      currentPage: 1,
+    };
+  },
+  created() {},
+  methods: {
+    changePage(page = this.currentPage) {
+      this.$emit('query', { skip: (page - 1) * this.limit, limit: this.limit, ...this.searchInfo });
+    },
+  },
+  computed: {
+    ...mapState(['user']),
+  },
+  metaInfo() {
+    return { title: this.$route.meta.title };
+  },
+  watch: {
+    test: {
+      deep: true,
+      immediate: true,
+      handler(val) {},
+    },
+  },
+};
+</script>
+
+<style lang="less" scoped></style>
+G