当前位置: 首页 > news >正文

wordpress后台使用方法seo培训师

wordpress后台使用方法,seo培训师,网站建设与管理规范,wordpress 文章名Vxe UI vue vxe-table v4.8 与 v3.10 导出 xlsx、支持导出合并、设置样式、宽高、边框、字体、背景、超链接、图片等、所有常用的 Excel 格式都能自定义,使用非常简单,纯前端实现复杂的导出。 安装插件 npm install vxe-pc-ui4.2.39 vxe-table4.8.0 vx…

Vxe UI vue vxe-table v4.8+ 与 v3.10+ 导出 xlsx、支持导出合并、设置样式、宽高、边框、字体、背景、超链接、图片等、所有常用的 Excel 格式都能自定义,使用非常简单,纯前端实现复杂的导出。

安装插件

npm install vxe-pc-ui@4.2.39 vxe-table@4.8.0 @vxe-ui/plugin-export-xlsx@4.0.7 exceljs@4.4.0
// ...
import { VxeUI } from 'vxe-pc-ui'
import VxeUIPluginExportXLSX from '@vxe-ui/plugin-export-xlsx'
// ...VxeUI.use(VxeUIPluginExportXLSX)

在 index.html 引入对应的解析库,把对应的 js 下载到本地引入。

<script src="https://vxeui.com/umd/exceljs@4.4.0/dist/exceljs.min.js"></script>

默认导出

默认支持文本和单元格合并等导出,只需要开启对应的功能就可以直接使用了。
在这里插入图片描述

在这里插入图片描述

<template><div><vxe-button @click="exportEvent">高级导出</vxe-button><vxe-grid ref="gridRef" v-bind="gridOptions"></vxe-grid></div>
</template><script setup>
import { ref, reactive } from 'vue'const gridRef = ref()const gridOptions = reactive({border: true,showFooter: true,mergeCells: [{ row: 0, col: 2, rowspan: 2, colspan: 2 },{ row: 2, col: 1, rowspan: 3, colspan: 2 }],exportConfig: {type: 'xlsx'},columns: [{ field: 'seq', type: 'seq', width: 70 },{title: '分组1',children: [{ field: 'name', title: 'Name' },{ field: 'role', title: 'Role' }]},{ field: 'sex', title: 'Sex' },{ field: 'age', title: 'Age' }],data: [{ id: 10001, name: '张三', role: 'Develop', sex: 'Man', age: 28, address: 'test abc' },{ id: 10002, name: '李四', role: 'Test', sex: 'Women', age: 22, address: '广东省' },{ id: 10003, name: '王五', role: 'PM', sex: 'Man', age: 32, address: '上海' },{ id: 10004, name: '老六', role: 'Designer', sex: 'Women', age: 24, address: 'Shanghai' },{ id: 10005, name: '小七', role: 'Designer', sex: 'Man', age: 37, address: '广东省' },{ id: 10006, name: '小八', role: 'Designer', sex: 'Man', age: 39, address: 'Shanghai' }],footerData: [{ seq: '合计', name: '12人', no1: 356 }]
})const exportEvent = () => {const $grid = gridRef.valueif ($grid) {$grid.openExport()}
}
</script>

参数说明

通过 sheetMethod 自定义方法实现,参数说明 exportConfig.sheetMethod({
workbook 工作簿对象
worksheet 表对象
options 当前参数
})

自定义边框

在这里插入图片描述

<template><div><vxe-button @click="exportEvent">点击导出</vxe-button><vxe-grid ref="gridRef" v-bind="gridOptions"></vxe-grid></div>
</template><script setup>
import { ref, reactive } from 'vue'const gridRef = ref()const gridOptions = reactive({border: true,showFooter: true,exportConfig: {sheetMethod (params) {const { worksheet } = paramsworksheet.eachRow(excelRow => {excelRow.eachCell(excelCell => {// 设置单元格边框excelCell.border = {top: {style: 'thin',color: {argb: 'ff0000'}},left: {style: 'thin',color: {argb: 'ff0000'}},bottom: {style: 'thin',color: {argb: 'ff0000'}},right: {style: 'thin',color: {argb: 'ff0000'}}}})})}},columns: [{ field: 'seq', type: 'seq', width: 70 },{title: '分组1',children: [{ field: 'name', title: 'Name' },{ field: 'role', title: 'Role' }]},{ field: 'sex', title: 'Sex' },{ field: 'no1', title: 'NO1' },{ field: 'no2', title: 'NO2 String', cellType: 'string' }],data: [{ id: 10001, name: '张三', role: 'Develop', sex: 'Man', no1: '028', no2: '028' },{ id: 10002, name: '李四', role: '研发', sex: 'Women', no1: '220', no2: '220' },{ id: 10003, name: '王五', role: '产品经理', sex: 'Man', no1: '003200', no2: '003200' },{ id: 10004, name: '老六', role: 'Designer', sex: 'Women', no1: '02040', no2: '02040' }],footerData: [{ seq: '合计', name: '12人', no1: '356' }]
})const exportEvent = () => {const $grid = gridRef.valueif ($grid) {$grid.exportData({type: 'xlsx'})}
}
</script>

自定义字体

在这里插入图片描述

<template><div><vxe-button @click="exportEvent">点击导出</vxe-button><vxe-grid ref="gridRef" v-bind="gridOptions"></vxe-grid></div>
</template><script setup>
import { ref, reactive } from 'vue'const gridRef = ref()const gridOptions = reactive({border: true,showFooter: true,exportConfig: {sheetMethod (params) {const { worksheet } = paramsworksheet.eachRow(excelRow => {excelRow.eachCell(excelCell => {// 设置单元格字体excelCell.font = {bold: true,size: 16,color: {argb: 'ff0000'}}})})}},columns: [{ field: 'seq', type: 'seq', width: 70 },{title: '分组1',children: [{ field: 'name', title: 'Name' },{ field: 'role', title: 'Role' }]},{ field: 'sex', title: 'Sex' },{ field: 'no1', title: 'NO1' },{ field: 'no2', title: 'NO2 String', cellType: 'string' }],data: [{ id: 10001, name: '张三', role: 'Develop', sex: 'Man', no1: '028', no2: '028' },{ id: 10002, name: '李四', role: '研发', sex: 'Women', no1: '220', no2: '220' },{ id: 10003, name: '王五', role: '产品经理', sex: 'Man', no1: '003200', no2: '003200' },{ id: 10004, name: '老六', role: 'Designer', sex: 'Women', no1: '02040', no2: '02040' }],footerData: [{ seq: '合计', name: '12人', no1: '356' }]
})const exportEvent = () => {const $grid = gridRef.valueif ($grid) {$grid.exportData({type: 'xlsx'})}
}
</script>

自定义表头背景

在这里插入图片描述

<template><div><vxe-button @click="exportEvent">点击导出</vxe-button><vxe-grid ref="gridRef" v-bind="gridOptions"></vxe-grid></div>
</template><script setup>
import { ref, reactive } from 'vue'const gridRef = ref()const gridOptions = reactive({border: true,showFooter: true,exportConfig: {sheetMethod (params) {const { worksheet } = paramsworksheet.eachRow((excelRow, rowIndex) => {if (rowIndex <= 2) {excelRow.eachCell(excelCell => {// 填充单元格背景excelCell.fill = {type: 'pattern',pattern: 'solid',fgColor: {argb: 'c5d9f1'}}})}})}},columns: [{ field: 'seq', type: 'seq', width: 70 },{title: '分组1',children: [{ field: 'name', title: 'Name' },{ field: 'role', title: 'Role' }]},{ field: 'sex', title: 'Sex' },{ field: 'no1', title: 'NO1' },{ field: 'no2', title: 'NO2 String', cellType: 'string' }],data: [{ id: 10001, name: '张三', role: 'Develop', sex: 'Man', no1: '028', no2: '028' },{ id: 10002, name: '李四', role: '研发', sex: 'Women', no1: '220', no2: '220' },{ id: 10003, name: '王五', role: '产品经理', sex: 'Man', no1: '003200', no2: '003200' },{ id: 10004, name: '老六', role: 'Designer', sex: 'Women', no1: '02040', no2: '02040' }],footerData: [{ seq: '合计', name: '12人', no1: '356' }]
})const exportEvent = () => {const $grid = gridRef.valueif ($grid) {$grid.exportData({type: 'xlsx'})}
}
</script>

自定义列宽

覆盖默认的列宽
在这里插入图片描述

<template><div><vxe-button @click="exportEvent">点击导出</vxe-button><vxe-grid ref="gridRef" v-bind="gridOptions"></vxe-grid></div>
</template><script setup>
import { ref, reactive } from 'vue'const gridRef = ref()const gridOptions = reactive({border: true,showFooter: true,exportConfig: {async sheetMethod (params) {const { worksheet } = paramsworksheet.columns.forEach(sheetColumn => {// 设置列宽sheetColumn.width = 16})}},columns: [{ field: 'seq', type: 'seq', width: 70 },{title: '分组1',children: [{ field: 'name', title: 'Name' },{ field: 'role', title: 'Role' }]},{ field: 'sex', title: 'Sex' },{ field: 'no1', title: 'NO1' },{ field: 'no2', title: 'NO2 String', cellType: 'string' }],data: [{ id: 10001, name: '张三', role: 'Develop', sex: 'Man', no1: '028', no2: '028' },{ id: 10002, name: '李四', role: '研发', sex: 'Women', no1: '220', no2: '220' },{ id: 10003, name: '王五', role: '产品经理', sex: 'Man', no1: '003200', no2: '003200' },{ id: 10004, name: '老六', role: 'Designer', sex: 'Women', no1: '02040', no2: '02040' }],footerData: [{ seq: '合计', name: '12人', no1: '356' }]
})const exportEvent = () => {const $grid = gridRef.valueif ($grid) {$grid.exportData({type: 'xlsx'})}
}
</script>

自定义行高

覆盖默认的行高
在这里插入图片描述

<template><div><vxe-button @click="exportEvent">点击导出</vxe-button><vxe-grid ref="gridRef" v-bind="gridOptions"></vxe-grid></div>
</template><script setup>
import { ref, reactive } from 'vue'const gridRef = ref()const gridOptions = reactive({border: true,showFooter: true,exportConfig: {async sheetMethod (params) {const { worksheet } = paramsworksheet.eachRow((excelRow, rowIndex) => {// 设置行高excelRow.height = 60})}},columns: [{ field: 'seq', type: 'seq', width: 70 },{title: '分组1',children: [{ field: 'name', title: 'Name' },{ field: 'role', title: 'Role' }]},{ field: 'sex', title: 'Sex' },{ field: 'no1', title: 'NO1' },{ field: 'no2', title: 'NO2 String', cellType: 'string' }],data: [{ id: 10001, name: '张三', role: 'Develop', sex: 'Man', no1: '028', no2: '028' },{ id: 10002, name: '李四', role: '研发', sex: 'Women', no1: '220', no2: '220' },{ id: 10003, name: '王五', role: '产品经理', sex: 'Man', no1: '003200', no2: '003200' },{ id: 10004, name: '老六', role: 'Designer', sex: 'Women', no1: '02040', no2: '02040' }],footerData: [{ seq: '合计', name: '12人', no1: '356' }]
})const exportEvent = () => {const $grid = gridRef.valueif ($grid) {$grid.exportData({type: 'xlsx'})}
}
</script>

添加超链接

在这里插入图片描述

<template><div><vxe-button @click="exportEvent">点击导出</vxe-button><vxe-grid ref="gridRef" v-bind="gridOptions"></vxe-grid></div>
</template><script setup>
import { ref, reactive } from 'vue'const gridRef = ref()const gridOptions = reactive({border: true,showFooter: true,exportConfig: {sheetMethod (params) {const { worksheet } = paramsworksheet.eachRow((excelRow, rowIndex) => {if (rowIndex > 2) {excelRow.eachCell((excelCell, columnIndex) => {if (columnIndex === 2) {// 设置指定单元格为超链接excelCell.value = {text: `${excelCell.value}`,hyperlink: 'https://vxeui.com',tooltip: 'vxeui.com'}// 设置单元格字体excelCell.font = {color: {argb: '0000ff'}}}})}})}},columns: [{ field: 'seq', type: 'seq', width: 70 },{title: '分组1',children: [{ field: 'name', title: 'Name' },{ field: 'role', title: 'Role' }]},{ field: 'sex', title: 'Sex' },{ field: 'no1', title: 'NO1' },{ field: 'no2', title: 'NO2 String', cellType: 'string' }],data: [{ id: 10001, name: '张三', role: 'Develop', sex: 'Man', no1: '028', no2: '028' },{ id: 10002, name: '李四', role: '研发', sex: 'Women', no1: '220', no2: '220' },{ id: 10003, name: '王五', role: '产品经理', sex: 'Man', no1: '003200', no2: '003200' },{ id: 10004, name: '老六', role: 'Designer', sex: 'Women', no1: '02040', no2: '02040' }],footerData: [{ seq: '合计', name: '12人', no1: '356' }]
})const exportEvent = () => {const $grid = gridRef.valueif ($grid) {$grid.exportData({type: 'xlsx'})}
}
</script>

添加图片

图片支持 buffer 和 base64 格式。
在这里插入图片描述

<template><div><vxe-button @click="exportEvent">点击导出</vxe-button><vxe-grid ref="gridRef" v-bind="gridOptions"></vxe-grid></div>
</template><script setup>
import { ref, reactive } from 'vue'const gridRef = ref()const gridOptions = reactive({border: true,showFooter: true,exportConfig: {async sheetMethod (params) {const { worksheet, workbook } = params// 加载图片const buffer1 = await fetch('https://vxeui.com/logo.png').then(res => res.arrayBuffer())const imageId1 = workbook.addImage({buffer: buffer1,extension: 'png'})worksheet.eachRow((excelRow, rowIndex) => {if (rowIndex > 2) {// 设置行高excelRow.height = 60excelRow.eachCell((excelCell, columnIndex) => {if (columnIndex === 2) {// 将图片添加到单元格worksheet.addImage(imageId1, {tl: { col: columnIndex - 1, row: rowIndex - 1 },ext: { width: 40, height: 40 }})}})}})}},columns: [{ field: 'seq', type: 'seq', width: 70 },{title: '分组1',children: [{ field: 'name', title: 'Name' },{ field: 'role', title: 'Role' }]},{ field: 'sex', title: 'Sex' },{ field: 'no1', title: 'NO1' },{ field: 'no2', title: 'NO2 String', cellType: 'string' }],data: [{ id: 10001, name: '张三', role: 'Develop', sex: 'Man', no1: '028', no2: '028' },{ id: 10002, name: '李四', role: '研发', sex: 'Women', no1: '220', no2: '220' },{ id: 10003, name: '王五', role: '产品经理', sex: 'Man', no1: '003200', no2: '003200' },{ id: 10004, name: '老六', role: 'Designer', sex: 'Women', no1: '02040', no2: '02040' }],footerData: [{ seq: '合计', name: '12人', no1: '356' }]
})
const exportEvent = () => {const $grid = gridRef.valueif ($grid) {$grid.exportData({type: 'xlsx'})}
}
</script>

github https://github.com/x-extends/vxe-table
gitee


文章转载自:
http://brimless.pqbz.cn
http://lapland.pqbz.cn
http://eucalypt.pqbz.cn
http://sciential.pqbz.cn
http://novobiocin.pqbz.cn
http://accordancy.pqbz.cn
http://merchantman.pqbz.cn
http://goggle.pqbz.cn
http://hopple.pqbz.cn
http://floruit.pqbz.cn
http://middlebrow.pqbz.cn
http://omnitude.pqbz.cn
http://habituation.pqbz.cn
http://buckboard.pqbz.cn
http://auxilytic.pqbz.cn
http://noho.pqbz.cn
http://portfolio.pqbz.cn
http://stylography.pqbz.cn
http://trigonometer.pqbz.cn
http://dateable.pqbz.cn
http://epicyclic.pqbz.cn
http://tartlet.pqbz.cn
http://transition.pqbz.cn
http://hippo.pqbz.cn
http://uneasily.pqbz.cn
http://mcm.pqbz.cn
http://colorant.pqbz.cn
http://reporting.pqbz.cn
http://perique.pqbz.cn
http://sumpter.pqbz.cn
http://undignify.pqbz.cn
http://pyrene.pqbz.cn
http://obstupefy.pqbz.cn
http://swordsmanship.pqbz.cn
http://villanage.pqbz.cn
http://dittany.pqbz.cn
http://carbamic.pqbz.cn
http://hundredthly.pqbz.cn
http://catagenesis.pqbz.cn
http://muskrat.pqbz.cn
http://solemnify.pqbz.cn
http://irak.pqbz.cn
http://rhombohedron.pqbz.cn
http://legist.pqbz.cn
http://misgovernment.pqbz.cn
http://surcoat.pqbz.cn
http://divest.pqbz.cn
http://ladylike.pqbz.cn
http://aia.pqbz.cn
http://rabbitlike.pqbz.cn
http://vaccination.pqbz.cn
http://aeroembolism.pqbz.cn
http://song.pqbz.cn
http://divisionism.pqbz.cn
http://sundried.pqbz.cn
http://vibraharp.pqbz.cn
http://idiotropic.pqbz.cn
http://diplont.pqbz.cn
http://turnscrew.pqbz.cn
http://microminiature.pqbz.cn
http://smuttiness.pqbz.cn
http://politicker.pqbz.cn
http://yautia.pqbz.cn
http://antitheism.pqbz.cn
http://holotype.pqbz.cn
http://sheshbesh.pqbz.cn
http://mmcd.pqbz.cn
http://off.pqbz.cn
http://caddie.pqbz.cn
http://citronellol.pqbz.cn
http://vanadium.pqbz.cn
http://meritocrat.pqbz.cn
http://selfwards.pqbz.cn
http://israelite.pqbz.cn
http://toxicoid.pqbz.cn
http://xanthism.pqbz.cn
http://ademption.pqbz.cn
http://rotifer.pqbz.cn
http://khorramshahr.pqbz.cn
http://belecture.pqbz.cn
http://coulisse.pqbz.cn
http://sufflate.pqbz.cn
http://bunghole.pqbz.cn
http://showgirl.pqbz.cn
http://plowshare.pqbz.cn
http://pittite.pqbz.cn
http://misgave.pqbz.cn
http://inertial.pqbz.cn
http://trespasser.pqbz.cn
http://hydrocephaloid.pqbz.cn
http://thelma.pqbz.cn
http://baroness.pqbz.cn
http://lord.pqbz.cn
http://minor.pqbz.cn
http://deurbanize.pqbz.cn
http://collateralize.pqbz.cn
http://eructate.pqbz.cn
http://f2f.pqbz.cn
http://guestimate.pqbz.cn
http://loyalize.pqbz.cn
http://www.dt0577.cn/news/93546.html

相关文章:

  • 网站会动的页面怎么做的广州谷歌seo
  • 建设部网站职责划定自媒体视频剪辑培训班
  • 做网站后台的时候误删了数据库的表如何创建一个网址
  • 做新闻网站编辑需要什么百度客户端下载安装
  • 微软做网站软件东莞海外网络推广
  • 南宁市网站维护与推广公司专注于网站营销服务
  • 重庆室内设计学校seo研究中心倒闭
  • 漳州做网站网络营销成功案例
  • wordpress商业插件seo如何提升排名收录
  • 网站建设与管理自考试题及答案广州seo学徒
  • flash相册网站源码seo入门版
  • 湖南衡阳市建设工程造价网站服务器域名查询
  • 手机网站开发模板seo快速排名软件案例
  • 可以做编程题的网站营销型网站的类型有哪些
  • 崆峒区建设局网站19
  • 自适应网站建设深圳网络公司推广
  • 做淘宝客一定要网站吗黄冈网站推广
  • 怎样加入好大夫网站做医生实时新闻
  • 杭州湾新区开发建设公司网站哪里注册域名最便宜
  • 潍坊网站建设官网软文生成器
  • 谈谈你对网站建设有什么样好的建设意见新站整站优化
  • dedecms网站布局的模版修改方法seo规则
  • 微信网站开发报价b2b推广网站
  • wordpress 编辑主题游戏优化大师官方下载
  • 安阳网站建设公司出租车公司如何建立网站平台
  • 手机网站dedecms百度在线客服
  • 网站开发资金规模深圳海外推广
  • 做律师事务所网站站外seo是什么
  • 官方网站是什么意思湖北seo推广
  • php做视频网站优化网站的步骤