index.vue 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111
  1. <template>
  2. <el-row :gutter="20">
  3. <el-col :span="24">
  4. <vab-query-form>
  5. <vab-query-form-top-panel>
  6. <el-form :inline="true" label-width="0" @submit.native.prevent>
  7. <el-form-item label="">
  8. <el-input v-model="queryForm.title" />
  9. </el-form-item>
  10. <el-form-item label-width="0">
  11. <el-button native-type="submit" type="primary" @click="queryData">查询</el-button>
  12. </el-form-item>
  13. </el-form>
  14. </vab-query-form-top-panel>
  15. </vab-query-form>
  16. </el-col>
  17. <el-col v-for="(item, index) in queryIcon" :key="index" :span="6">
  18. <el-card shadow="hover" @click.native="handleIcon(item)">
  19. <vab-icon :icon="item" />
  20. </el-card>
  21. </el-col>
  22. <el-col :span="24">
  23. <el-pagination
  24. :background="background"
  25. :current-page="queryForm.pageNum"
  26. :layout="layout"
  27. :page-size="queryForm.pageSize"
  28. :total="total"
  29. @current-change="handleCurrentChange"
  30. @size-change="handleSizeChange" />
  31. </el-col>
  32. </el-row>
  33. </template>
  34. <script>
  35. import { getRemixIconList } from './remixIcon'
  36. export default {
  37. name: 'VabIconSelector',
  38. data() {
  39. return {
  40. icon: '24-hours-fill',
  41. layout: 'total, prev, next',
  42. total: 0,
  43. background: true,
  44. height: 0,
  45. selectRows: '',
  46. queryIcon: [],
  47. queryForm: {
  48. pageNum: 1,
  49. pageSize: 16,
  50. title: '',
  51. },
  52. }
  53. },
  54. created() {
  55. this.fetchData()
  56. },
  57. methods: {
  58. handleSizeChange(val) {
  59. this.queryForm.pageSize = val
  60. this.fetchData()
  61. },
  62. handleCurrentChange(val) {
  63. this.queryForm.pageNum = val
  64. this.fetchData()
  65. },
  66. queryData() {
  67. this.queryForm.pageNum = 1
  68. this.fetchData()
  69. },
  70. fetchData() {
  71. const { list, total } = getRemixIconList(this.queryForm.title, this.queryForm.pageNum, this.queryForm.pageSize)
  72. this.queryIcon = list
  73. this.total = total
  74. },
  75. handleIcon(item) {
  76. this.icon = item
  77. this.$emit('handle-icon', item)
  78. },
  79. },
  80. }
  81. </script>
  82. <style lang="scss">
  83. .icon-selector-popper {
  84. .el-card__body {
  85. position: relative;
  86. display: flex;
  87. flex-direction: column;
  88. align-items: center;
  89. justify-content: center;
  90. height: 20px;
  91. cursor: pointer;
  92. i {
  93. font-size: 28px;
  94. color: $base-color-grey;
  95. text-align: center;
  96. vertical-align: middle;
  97. pointer-events: none;
  98. cursor: pointer;
  99. }
  100. }
  101. .el-pagination {
  102. margin: 0;
  103. }
  104. }
  105. </style>