您的当前位置:首页正文

element-ui表格el-table的使用

2024-11-23 来源:个人技术集锦

先给大家展示一下效果

Table 属性 

Table 事件 

事件名说明回调参数
select当用户手动勾选数据行的 Checkbox 时触发的事件selection, row
select-all当用户手动勾选全选 Checkbox 时触发的事件selection
selection-change当选择项发生变化时会触发该事件selection
cell-mouse-enter当单元格 hover 进入时会触发该事件row, column, cell, event
cell-mouse-leave当单元格 hover 退出时会触发该事件row, column, cell, event
cell-click当某个单元格被点击时会触发该事件row, column, cell, event
cell-dblclick当某个单元格被双击击时会触发该事件row, column, cell, event
cell-contextmenu当某个单元格被鼠标右键点击时会触发该事件row, column, cell, event
row-click当某一行被点击时会触发该事件row, column, event
row-contextmenu当某一行被鼠标右键点击时会触发该事件row, column, event
row-dblclick当某一行被双击时会触发该事件row, column, event
header-click当某一列的表头被点击时会触发该事件column, event
header-contextmenu当某一列的表头被鼠标右键点击时触发该事件column, event
sort-change当表格的排序条件发生变化的时候会触发该事件{ column, prop, order }
filter-changecolumn 的 key, 如果需要使用 filter-change 事件,则需要此属性标识是哪个 column 的筛选条件filters
current-change当表格的当前行发生变化的时候会触发该事件,如果要高亮当前行,请打开表格的 highlight-current-row 属性currentRow, oldCurrentRow
header-dragend当拖动表头改变了列的宽度的时候会触发该事件newWidth, oldWidth, column, event
expand-change当用户对某一行展开或者关闭的时候会触发该事件(展开行时,回调的第二个参数为 expandedRows;树形表格时第二参数为 expanded)row, (expandedRows | expanded)

Table 方法 

方法名说明参数
clearSelection用于多选表格,清空用户的选择
getSelectionRows返回当前选中的行
toggleRowSelection用于多选表格,切换某一行的选中状态, 如果使用了第二个参数,则可直接设置这一行选中与否row, selected
toggleAllSelection用于多选表格,切换全选和全不选
toggleRowExpansion用于可扩展的表格或树表格,如果某行被扩展,则切换。 使用第二个参数,您可以直接设置该行应该被扩展或折叠。row, expanded
setCurrentRow用于单选表格,设定某一行为选中行, 如果调用时不加参数,则会取消目前高亮行的选中状态。row
clearSort用于清空排序条件,数据会恢复成未排序的状态
clearFilter传入由columnKey 组成的数组以清除指定列的过滤条件。 如果没有参数,清除所有过滤器columnKeys
doLayout对 Table 进行重新布局。 当表格可见性变化时,您可能需要调用此方法以获得正确的布局
sort手动排序表格。 参数 prop 属性指定排序列,order 指定排序顺序。prop: string, order: string
scrollTo滚动到一组特定坐标(options: ScrollToOptions | number, yCoord?: number)
setScrollTop设置垂直滚动位置top
setScrollLeft设置水平滚动位置left

Table 插槽 

插槽名说明子标签
-自定义默认内容Table-column
append插入至表格最后一行之后的内容, 如果需要对表格的内容进行无限滚动操作,可能需要用到这个 slot。 若表格有合计行,该 slot 会位于合计行之上。
empty当数据为空时自定义的内容

Table-column 属性 

属性名说明类型可选值默认值
type对应列的类型。 如果设置了selection则显示多选框; 如果设置了 index 则显示该行的索引(从 1 开始计算); 如果设置了 expand 则显示为一个可展开的按钮stringselection / index / expand
index如果设置了 type=index,可以通过传递 index 属性来自定义索引number / function(index)
label显示的标题string
column-keycolumn 的 key, column 的 key, 如果需要使用 filter-change 事件,则需要此属性标识是哪个 column 的筛选条件string
prop字段名称 对应列内容的字段名, 也可以使用 property属性string
width对应列的宽度string / number
min-width对应列的最小宽度, 对应列的最小宽度, 与 width 的区别是 width 是固定的,min-width 会把剩余宽度按比例分配给设置了 min-width 的列string / number
fixed列是否固定在左侧或者右侧。 true 表示固定在左侧string / booleantrue / 'left' / 'right'
render-header列标题 Label 区域渲染使用的 Functionfunction({ column, $index })
sortable对应列是否可以排序, 如果设置为 'custom',则代表用户希望远程排序,需要监听 Table 的 sort-change 事件boolean / stringcustomfalse
sort-method指定数据按照哪个属性进行排序,仅当sortable设置为true的时候有效。 应该如同 Array.sort 那样返回一个 Numberfunction(a, b)
sort-by指定数据按照哪个属性进行排序,仅当 sortable 设置为 true 且没有设置 sort-method 的时候有效。 如果 sort-by 为数组,则先按照第 1 个属性排序,如果第 1 个相等,再按照第 2 个排序,以此类推function(row, index) / string / array
sort-orders数据在排序时所使用排序策略的轮转顺序,仅当 sortable 为 true 时有效。 需传入一个数组,随着用户点击表头,该列依次按照数组中元素的顺序进行排序array数组中的元素需为以下三者之一:ascending 表示升序,descending 表示降序,null 表示还原为原始顺序['ascending', 'descending', null]
resizable对应列是否可以通过拖动改变宽度(需要在 el-table 上设置 border 属性为真)booleantrue
formatter用来格式化内容function(row, column, cellValue, index)
show-overflow-tooltip当内容过长被隐藏时显示 tooltipboolean \ 2.2.28参考表格的
align对齐方式stringleft / center / rightleft
header-align表头对齐方式, 若不设置该项,则使用表格的对齐方式stringleft / center / right
class-name列的 classNamestring
label-class-name当前列标题的自定义类名string
selectable仅对 type=selection 的列有效,类型为 Function,Function 的返回值用来决定这一行的 CheckBox 是否可以勾选function(row, index)
reserve-selection数据刷新后是否保留选项,仅对 type=selection 的列有效, 请注意, 需指定 row-key 来让这个功能生效。booleanfalse
filters数据过滤的选项, 数组格式,数组中的元素需要有 text 和 value 属性。 数组中的每个元素都需要有 text 和 value 属性。Array<{text: string, value: string}>
filter-placement过滤弹出框的定位string与 Tooltip 的 placement 属性相同
filter-multiple数据过滤的选项是否多选booleantrue
filter-method数据过滤使用的方法, 如果是多选的筛选项,对每一条数据会执行多次,任意一次返回 true 就会显示。function(value, row, column)
filtered-value选中的数据过滤项,如果需要自定义表头过滤的渲染方式,可能会需要此属性。array

Table-column 插槽 

插槽名说明
自定义列的内容 作用域参数为 { row, column, $index }
header自定义表头的内容, 作用域参数为 { column, $index }

表格部分代码

  <!--表格数据展示 start-->
      <el-table :data="dataList.list" style="width:1300px;">
        <el-table-column prop="bookImg" label="图片" width="150" align="center">
          <template #default="scope">
            <img :src="scope.row.bookImg" style="height:60px"/>
          </template>
        </el-table-column>
        <el-table-column  prop="bookTypeId" label="类型" width="100px">
          <template #default="scope">
                <span v-for="item in typeList.list" :key="item.bookTypeId">
                    {{ scope.row.bookTypeId == item.bookTypeId ? item.bookTypeName : '' }}
                </span>
          </template>
        </el-table-column>
        <el-table-column  prop="bookName" label="名称" width="100" align="center">
          <template #default="scope">
            <div style="color: #6ca7ef;" v-html="scope.row.bookName"></div>
          </template>
        </el-table-column>
        <el-table-column prop="bookPrice" label="价格" width="100" align="center"></el-table-column>
        <el-table-column show-overflow-tooltip prop="bookWriter" label="作者" width="60" align="center">
        </el-table-column>
        <el-table-column show-overflow-tooltip prop="bookPublishHouse" label="出版社" width="80" align="center">
        </el-table-column>
        <el-table-column prop="bookPublishTime" label="出版时间" width="100" align="center"></el-table-column>
        <el-table-column show-overflow-tooltip prop="bookISBN" label="ISBN号" width="100"
                         align="center"></el-table-column>
        <el-table-column prop="bookStock" label="库存" width="100" align="center"></el-table-column>
        <el-table-column prop="bookSalvesVolume" label="销量" width="100" align="center"></el-table-column>
        <el-table-column show-overflow-tooltip prop="bookCatalog" label="目录" width="60" align="center">
        </el-table-column>
        <el-table-column show-overflow-tooltip prop="bookDesc" label="简介" width="60" align="center">
        </el-table-column>
        <el-table-column label="操作" width="200" align="center">
          <template #default="scope">
            <el-button round size="small" type="primary"
                       @click="handleEdit(scope.$index, scope.row)">修改
            </el-button>
            <el-button round size="small" type="danger"
                       @click="handleDelete(scope.$index, scope.row)">删除
            </el-button>
          </template>
        </el-table-column>
      </el-table>
      <!--表格数据展示 end-->

全部代码 

<template>
  <div class="data-container">
    <!--添加 start-->
    <div class="data-header">
      <!--优化:@keyup.enter="searchHandle"回车时触发searchHandle事件-->
      <el-input class="input" @keyup.enter="searchHandle" v-model="searchInfo" size="large"
                placeholder="请输入名称/作者/出版社"></el-input>
      <el-button @click="searchHandle" class="button" size="large" type="primary" plain>搜索</el-button>
      <el-button @click="addHander" style="margin-left: 40px;" size="large" class="button" type="primary">
        <el-icon>
          <DocumentAdd/>
        </el-icon>&nbsp;添加
      </el-button>
    </div>
    <!--添加 end-->
    <div class="data-table">
      <!--表格数据展示 start-->
      <el-table :data="dataList.list" style="width:1300px;">
        <el-table-column prop="bookImg" label="图片" width="150" align="center">
          <template #default="scope">
            <img :src="scope.row.bookImg" style="height:60px"/>
          </template>
        </el-table-column>
        <el-table-column  prop="bookTypeId" label="类型" width="100px">
          <template #default="scope">
                <span v-for="item in typeList.list" :key="item.bookTypeId">
                    {{ scope.row.bookTypeId == item.bookTypeId ? item.bookTypeName : '' }}
                </span>
          </template>
        </el-table-column>
        <el-table-column  prop="bookName" label="名称" width="100" align="center">
          <template #default="scope">
            <div style="color: #6ca7ef;" v-html="scope.row.bookName"></div>
          </template>
        </el-table-column>
        <el-table-column prop="bookPrice" label="价格" width="100" align="center"></el-table-column>
        <el-table-column show-overflow-tooltip prop="bookWriter" label="作者" width="60" align="center">
        </el-table-column>
        <el-table-column show-overflow-tooltip prop="bookPublishHouse" label="出版社" width="80" align="center">
        </el-table-column>
        <el-table-column prop="bookPublishTime" label="出版时间" width="100" align="center"></el-table-column>
        <el-table-column show-overflow-tooltip prop="bookISBN" label="ISBN号" width="100"
                         align="center"></el-table-column>
        <el-table-column prop="bookStock" label="库存" width="100" align="center"></el-table-column>
        <el-table-column prop="bookSalvesVolume" label="销量" width="100" align="center"></el-table-column>
        <el-table-column show-overflow-tooltip prop="bookCatalog" label="目录" width="60" align="center">
        </el-table-column>
        <el-table-column show-overflow-tooltip prop="bookDesc" label="简介" width="60" align="center">
        </el-table-column>
        <el-table-column label="操作" width="200" align="center">
          <template #default="scope">
            <el-button round size="small" type="primary"
                       @click="handleEdit(scope.$index, scope.row)">修改
            </el-button>
            <el-button round size="small" type="danger"
                       @click="handleDelete(scope.$index, scope.row)">删除
            </el-button>
          </template>
        </el-table-column>
      </el-table>
      <!--表格数据展示 end-->
      <!--分页 start-->
      <div class="page">
        <el-pagination @current-change="currentChangeHaddler" background layout="prev,pager,next,jumper"
                       default-page-size="defaultPageSize" :total="totalData"></el-pagination>
      </div>
      <!--分页 end-->
      <!--添加对话框 start-->
      <el-dialog draggable destroy-on-close v-model="dialogAddVisible" title="添加" width="70%" center>
        <el-form :inline="true" :model="addFormInfo" status-icon label-width="120px">
          <el-form-item label="图片">
            <el-upload list-type="picture-card" action="http://localhost:8040/file/localhost/upload"
                       :on-success="onUploadAddSuccess" :on-remove="handleAddRemove">
              <el-icon>
                <Plus/>
              </el-icon>
            </el-upload>
          </el-form-item>
          <el-form-item label="类型">
            <el-select v-model="addFormInfo.bookTypeId" class="m-2" placeholder="请选择书籍类型" size="large">
              <el-option v-for="item in typeList.list" :key="item.bookTypeId" :label="item.bookTypeName"
                         :value="item.bookTypeId"/>
            </el-select>
          </el-form-item>
          <el-form-item label="名称">
            <el-input v-model="addFormInfo.bookName"></el-input>
          </el-form-item>
          <el-form-item label="价格">
            <el-input v-model="addFormInfo.bookPrice"></el-input>
          </el-form-item>
          <el-form-item label="作者">
            <el-input v-model="addFormInfo.bookWriter"></el-input>
          </el-form-item>
          <el-form-item label="出版社">
            <el-input v-model="addFormInfo.bookPublishHouse"></el-input>
          </el-form-item>
          <el-form-item label="出版时间">
            <el-input v-model="addFormInfo.bookPublishTime"></el-input>
          </el-form-item>
          <el-form-item label="ISBN号">
            <el-input v-model="addFormInfo.bookISBN"></el-input>
          </el-form-item>
          <el-form-item label="库存">
            <el-input v-model="addFormInfo.bookStock"></el-input>
          </el-form-item>
          <el-form-item label="销量">
            <el-input v-model="addFormInfo.bookSalvesVolume"></el-input>
          </el-form-item>
          <el-form-item label="目录">
            <el-input style="width: 800px" :rows="6" type="textarea" v-model="addFormInfo.bookCatalog"></el-input>
          </el-form-item>
          <el-form-item label="简介">
            <el-input style="width: 800px" :rows="6" type="textarea" v-model="addFormInfo.bookDesc"></el-input>
          </el-form-item>

        </el-form>
        <template #footer>
                    <span class="dialog-footer">
                        <el-button @click="dialogAddVisible = false">取消</el-button>
                        <el-button type="primary" @click="sureHandler">确定</el-button>
                    </span>
        </template>
      </el-dialog>
      <!--添加对话框 end-->
      <!--编辑对话框 start-->
      <el-dialog draggable destroy-on-close v-model="dialogEditorVisible" title="修改" width="70%" center>
        <el-form :inline="true" :model="editorFormInfo" label-width="120px">
          <el-form-item label="图片">
            <el-upload list-type="picture-card" action="http://localhost:8040/file/localhost/upload"
                       :show-file-list="false"
                       :on-success="onUploadEditorSuccess">
              <img v-if="fileEditorPath" :src="fileEditorPath" class="avatar" style="height:60px"/>
              <el-icon v-else class="avatar-uploader-icon">
                <Plus/>
              </el-icon>
            </el-upload>
          </el-form-item>
          <el-form-item label="类型">
            <el-select v-model="editorFormInfo.bookTypeId" class="m-2" placeholder="Select" size="large">
              <el-option v-for="item in typeList.list" :key="item.bookTypeId" :label="item.bookTypeName"
                         :value="item.bookTypeId"/>
            </el-select>
          </el-form-item>
          <el-form-item label="名称">
            <el-input v-model="editorFormInfo.bookName"></el-input>
          </el-form-item>
          <el-form-item label="价格">
            <el-input v-model="editorFormInfo.bookPrice"></el-input>
          </el-form-item>
          <el-form-item label="作者">
            <el-input v-model="editorFormInfo.bookWriter"></el-input>
          </el-form-item>
          <el-form-item label="出版社">
            <el-input v-model="editorFormInfo.bookPublishHouse"></el-input>
          </el-form-item>
          <el-form-item label="出版时间">
            <el-input v-model="editorFormInfo.bookPublishTime"></el-input>
          </el-form-item>
          <el-form-item label="ISBN号">
            <el-input v-model="editorFormInfo.bookISBN"></el-input>
          </el-form-item>
          <el-form-item label="库存">
            <el-input v-model="editorFormInfo.bookStock"></el-input>
          </el-form-item>
          <el-form-item label="销量">
            <el-input v-model="editorFormInfo.bookSalvesVolume"></el-input>
          </el-form-item>
          <el-form-item label="目录">
            <el-input style="width: 800px" :rows="6" type="textarea" v-model="editorFormInfo.bookCatalog"></el-input>
          </el-form-item>
          <el-form-item label="简介">
            <el-input style="width: 800px" :rows="6" type="textarea" v-model="editorFormInfo.bookDesc"></el-input>
          </el-form-item>
        </el-form>
        <template #footer>
                    <span class="dialog-footer">
                        <el-button @click="dialogEditorVisible = false">取消</el-button>
                        <el-button type="primary" @click="sureEditorHandler">确定</el-button>
                    </span>
        </template>
      </el-dialog>
      <!--编辑对话框 end-->
    </div>
  </div>
</template>
<script setup>
import axios from "@/utils/request.js"
import {onMounted, reactive, ref} from "vue";
//初始化类型列表
const typeList = reactive({
  list: []
})
//数据列表
const dataList = reactive({
  list: []
})
//数据总条数
const totalData = ref(0)
//当前页
const currentPage = ref(1)
//初始化分页显示条数
const defaultPageSize = ref(5)
//搜索初始化状态
const searchInfo = ref("")
//添加-上传后图片地址
const fileAddPath = ref(0)
//编辑-上传后图片地址
const fileEditorPath = ref(0)
//添加添加对话框控制器
const dialogAddVisible = ref(false)
//初始化添加对话框状态
const addFormInfo = reactive({

  bookImg: "",
  bookName: "",
  bookPrice: "",
  bookWriter: "",
  bookPublishHouse: "",
  bookPublishTime: "",
  bookISBN: "",
  bookStock: "",
  bookSalvesVolume: "",

  bookCatalog: "",

  bookDesc: "",

  bookTypeId: "",

})
//编辑对话框控制器
const dialogEditorVisible = ref(false)
//初始化编辑对话框状态
const editorFormInfo = reactive({
  bookId: "",
  bookImg: "",
  bookName: "",
  bookPrice: "",
  bookWriter: "",
  bookPublishHouse: "",
  bookPublishTime: "",
  bookISBN: "",
  bookStock: "",
  bookSalvesVolume: "",

  bookCatalog: "",

  bookDesc: "",

  bookTypeId: "",

})
/**
 * 网路请求:分页查询
 *  */
const http = (search, page, size) => {
  axios.get('/book/book/search', {
    params: {
      search,
      page,
      size
    }
  }).then(res => {
    if (res.data.code == 200) {
      dataList.list = res.data.data.records
      totalData.value = res.data.data.total
    } else {
      ElMessage.error(res.data.message)
    }

  })
}
onMounted(() => {
  http(null, 1, 5)
  axios.get('/book/bookType/findAll').then(res => {
    typeList.list = res.data.data
    console.log(typeList.list[0])
  })
})
/**
 * 添加时文件上传成功时的钩子
 */
const onUploadAddSuccess = (response, uploadFile) => {
  console.log(response)//http://192.168.66.101/group1/M00/00/00/wKhCZWQZ2Y6AfdIDAADHg7AcneY285.jpg
  console.log(uploadFile.raw.name)//springboot.jpg
  fileAddPath.value = response.data
}
/**
 * 编辑时文件上传成功时的钩子
 */
const onUploadEditorSuccess = (response, uploadFile) => {
  //console.log(response.data)//http://192.168.66.101/group1/M00/00/00/wKhCZWQZ2Y6AfdIDAADHg7AcneY285.jpg
  //console.log(uploadFile.raw.name)//springboot.jpg
  fileEditorPath.value = response.data
}
/**
 * 添加时文件移除时的操作
 */
const handleAddRemove = (file, files) => {
  //console.log(file.url)//file.url---blob:http://127.0.0.1:81/87591d3e-43e3-4032-bd61-c26867d32f0e
  //console.log(fileAddPath.value)
  axios.post('/book/book/delete', {
    params: {
      filePath: fileAddPath.value
    }
  }).then(res => {
    if (res.data.code == 200) {
      fileAddPath.value = null
      ElMessage.success("上传时移除图片成功")
    }
  })
}
/**
 * 分页
 */
const currentChangeHaddler = (val) => {
  http(searchInfo.value, val, 5)
  currentPage.value = val
}
/**
 * 搜索按钮
 */
const searchHandle = () => {
  http(searchInfo.value, 1, 5)
}
/**
 * 添加对话框弹出事件
 */
const addHander = () => {
  dialogAddVisible.value = true
}
/**
 * 添加对话框 确定事件
 */
const sureHandler = () => {
  axios.post('/book/book/add', {
    bookName: addFormInfo.bookName,
    bookPrice: addFormInfo.bookPrice,
    bookImg: fileAddPath.value,
    bookWriter: addFormInfo.bookWriter,
    bookPublishHouse: addFormInfo.bookPublishHouse,
    bookPublishTime: addFormInfo.bookPublishTime,
    bookISBN: addFormInfo.bookISBN,
    bookStock: addFormInfo.bookStock,
    bookSalvesVolume: addFormInfo.bookSalvesVolume,
    bookCatalog: addFormInfo.bookCatalog,
    bookDesc: addFormInfo.bookDesc,
    bookTypeId: addFormInfo.bookTypeId,
  }).then(res => {
    if (res.data.code == 200) {
      dialogAddVisible.value = false
      //刷新页面
      http(null, currentPage.value, 5)
      fileAddPath.value = null
    } else {
      ElMessage.error(res.data.message)
    }
  })
}
/**
 * 编辑对话框 弹出事件
 *  */
const handleEdit = (index, row) => {
  dialogEditorVisible.value = true
  axios.get('/book/book/findById', {
    params: {
      bookId: row.bookId
    }
  }).then(res => {
    if (res.data.code == 200) {
      editorFormInfo.bookId = res.data.data.bookId;
      fileEditorPath.value = res.data.data.bookImg;
      editorFormInfo.bookPrice = res.data.data.bookPrice;
      editorFormInfo.bookWriter = res.data.data.bookWriter;
      editorFormInfo.bookPublishHouse = res.data.data.bookPublishHouse;
      editorFormInfo.bookPublishTime = res.data.data.bookPublishTime;
      editorFormInfo.bookISBN = res.data.data.bookISBN;
      editorFormInfo.bookStock = res.data.data.bookStock;
      editorFormInfo.bookSalvesVolume = res.data.data.bookSalvesVolume;
      editorFormInfo.bookCatalog = res.data.data.bookCatalog;
      editorFormInfo.bookDesc = res.data.data.bookDesc;
      editorFormInfo.bookTypeId = res.data.data.bookTypeId;
    } else {
      ElMessage.error(res.data.data.message)
    }
  })

}
/**
 * 编辑对话框 确定事件
 */
const sureEditorHandler = () => {
  axios.post('/book/book/update', {
    bookId: editorFormInfo.bookId,
    bookName: editorFormInfo.bookName,
    bookPrice: editorFormInfo.bookPrice,
    bookImg: fileEditorPath.value,
    bookWriter: editorFormInfo.bookWriter,
    bookPublishHouse: editorFormInfo.bookPublishHouse,
    bookPublishTime: editorFormInfo.bookPublishTime,
    bookISBN: editorFormInfo.bookISBN,
    bookStock: editorFormInfo.bookStock,
    bookSalvesVolume: editorFormInfo.bookSalvesVolume,
    bookCatalog: editorFormInfo.bookCatalog,
    bookDesc: editorFormInfo.bookDesc,
    bookTypeId: editorFormInfo.bookTypeId,
  }).then(res => {
    if (res.data.code == 200) {
      dialogEditorVisible.value = false
      http(null, currentPage.value, 5)
    } else {
      ElMessage.error(res.data.message)
    }
  })
}

/**删除 */
const handleDelete = (index, row) => {
  ElMessageBox.confirm(
      '确定删除么',
      '删除',
      {
        confirmButtonText: '确定',
        cancelButtonText: '取消',
        type: 'warning',
      }
  ).then(() => {
    //确认删除
    axios.delete("/book/book/delete", {
      params: {
        bookId: row.bookId
      }
    }).then(res => {
      if (res.data.code == 200) {
        ElMessage({
          type: 'success',
          message: "删除成功!!!",
        })
        //刷新
        http(null, currentPage.value, 5)
      } else {
        ElMessage({
          type: 'error',
          message: res.data.message,
        })
      }
    })
  }).catch(error => {
    ElMessage({
      type: 'info',
      message: "取消删除",
    })
  })


}
</script>
<style scoped>
.el-carousel__item:nth-child(2n + 1) {
  background-color: #d3dce6;
}

.data-header {
  background: linear-gradient(left, rgb(89, 234, 233) 27%, rgb(131, 231, 218) 44%, rgb(69, 150, 216) 88%);
  background: -o-linear-gradient(left, rgb(89, 234, 233) 27%, rgb(131, 231, 218) 44%, rgb(69, 150, 216) 88%);
  background: -ms-linear-gradient(left, rgb(89, 234, 233) 27%, rgb(131, 231, 218) 44%, rgb(69, 150, 216) 88%);
  background: -moz-linear-gradient(left, rgb(89, 234, 233) 27%, rgb(131, 231, 218) 44%, rgb(69, 150, 216) 88%);
  background: -webkit-linear-gradient(left, rgb(89, 234, 233) 27%, rgb(131, 231, 218) 44%, rgb(69, 150, 216) 88%);
  padding: 20px;
  width: 100%;
  background-attachment: #fff;
  box-sizing: border-box;
}

.data-header span {
  color: #6ca7ef;
  font-weight: 700;
}

.data-header .input {
  width: 300px;
}

.data-table {
  background: linear-gradient(left, rgb(89, 234, 233) 27%, rgb(131, 231, 218) 44%, rgb(69, 150, 216) 88%);
  background: -o-linear-gradient(left, rgb(89, 234, 233) 27%, rgb(131, 231, 218) 44%, rgb(69, 150, 216) 88%);
  background: -ms-linear-gradient(left, rgb(89, 234, 233) 27%, rgb(131, 231, 218) 44%, rgb(69, 150, 216) 88%);
  background: -moz-linear-gradient(left, rgb(89, 234, 233) 27%, rgb(131, 231, 218) 44%, rgb(69, 150, 216) 88%);
  background: -webkit-linear-gradient(left, rgb(89, 234, 233) 27%, rgb(131, 231, 218) 44%, rgb(69, 150, 216) 88%);
  padding: 20px;
  display: flex;
  width: 100%;
  height: 700px;
}

.page {
  /**分页模块*/
  /**固定定位 元素的位置相对于浏览器窗口是固定位置。即使窗口是滚动的它也不会移动 */
  position: fixed;
  right: 10px;
  bottom: 100px;
}
</style>

显示全文