| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117 |
- <template>
- <el-row :gutter="20">
- <el-col :span="24">
- <vab-query-form>
- <vab-query-form-top-panel>
- <el-form :inline="true" label-width="0" @submit.native.prevent>
- <el-form-item label="">
- <el-input v-model="queryForm.title" />
- </el-form-item>
- <el-form-item label-width="0">
- <el-button native-type="submit" type="primary" @click="queryData">
- 查询
- </el-button>
- </el-form-item>
- </el-form>
- </vab-query-form-top-panel>
- </vab-query-form>
- </el-col>
- <el-col v-for="(item, index) in queryIcon" :key="index" :span="6">
- <el-card shadow="hover" @click.native="handleIcon(item)">
- <vab-icon :icon="item" />
- </el-card>
- </el-col>
- <el-col :span="24">
- <el-pagination
- :background="background"
- :current-page="queryForm.pageNum"
- :layout="layout"
- :page-size="queryForm.pageSize"
- :total="total"
- @current-change="handleCurrentChange"
- @size-change="handleSizeChange" />
- </el-col>
- </el-row>
- </template>
- <script>
- import { getRemixIconList } from './remixIcon'
- export default {
- name: 'VabIconSelector',
- data() {
- return {
- icon: '24-hours-fill',
- layout: 'total, prev, next',
- total: 0,
- background: true,
- height: 0,
- selectRows: '',
- queryIcon: [],
- queryForm: {
- pageNum: 1,
- pageSize: 16,
- title: '',
- },
- }
- },
- created() {
- this.fetchData()
- },
- methods: {
- handleSizeChange(val) {
- this.queryForm.pageSize = val
- this.fetchData()
- },
- handleCurrentChange(val) {
- this.queryForm.pageNum = val
- this.fetchData()
- },
- queryData() {
- this.queryForm.pageNum = 1
- this.fetchData()
- },
- fetchData() {
- const { list, total } = getRemixIconList(
- this.queryForm.title,
- this.queryForm.pageNum,
- this.queryForm.pageSize
- )
- this.queryIcon = list
- this.total = total
- },
- handleIcon(item) {
- this.icon = item
- this.$emit('handle-icon', item)
- },
- },
- }
- </script>
- <style lang="scss">
- .icon-selector-popper {
- .el-card__body {
- position: relative;
- display: flex;
- flex-direction: column;
- align-items: center;
- justify-content: center;
- height: 20px;
- cursor: pointer;
- i {
- font-size: 28px;
- color: $base-color-grey;
- text-align: center;
- vertical-align: middle;
- pointer-events: none;
- cursor: pointer;
- }
- }
- .el-pagination {
- margin: 0;
- }
- }
- </style>
|