index.vue 2.7 KB

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