如何使用 vue vxe-table 来实现一个产品对比表表格

查看官网:https://vxetable.cn

效果

在这里插入图片描述

代码

<template><div class="demo-page-wrapper"><vxe-grid v-bind="gridOptions"><template #img11><vxe-image src="https://vxeui.com/resource/productImg/m11.jpg" width="100%"></vxe-image></template><template #img12><vxe-image src="https://vxeui.com/resource/productImg/m12.jpg" width="100%"></vxe-image></template><template #img21><vxe-image src="https://vxeui.com/resource/productImg/m21.jpg" width="100%"></vxe-image></template><template #img22><vxe-image src="https://vxeui.com/resource/productImg/m22.jpg" width="100%"></vxe-image></template><template #img31><vxe-image src="https://vxeui.com/resource/productImg/m31.jpg" width="100%"></vxe-image></template><template #img32><vxe-image src="https://vxeui.com/resource/productImg/m32.jpg" width="100%"></vxe-image></template><template #cell11="{ row }"><span v-if="hasCheckboxCell(row.product11)">{{ row.product11 ? '✔️' : '❌' }}</span><span v-else>{{ row.product11 }}</span></template><template #cell12="{ row }"><span v-if="hasCheckboxCell(row.product12)">{{ row.product12 ? '✔️' : '❌' }}</span><span v-else>{{ row.product12 }}</span></template><template #cell21="{ row }"><span v-if="hasCheckboxCell(row.product21)">{{ row.product21 ? '✔️' : '❌' }}</span><span v-else>{{ row.product21 }}</span></template><template #cell22="{ row }"><span v-if="hasCheckboxCell(row.product22)">{{ row.product22 ? '✔️' : '❌' }}</span><span v-else>{{ row.product22 }}</span></template><template #cell31="{ row }"><span v-if="hasCheckboxCell(row.product31)">{{ row.product31 ? '✔️' : '❌' }}</span><span v-else>{{ row.product31 }}</span></template><template #cell32="{ row }"><span v-if="hasCheckboxCell(row.product32)">{{ row.product32 ? '✔️' : '❌' }}</span><span v-else>{{ row.product32 }}</span></template></vxe-grid></div>
</template><script setup>
import { reactive } from 'vue'
import XEUtils from 'xe-utils'const gridOptions = reactive({border: true,loading: false,showOverflow: true,height: '100%',toolbarConfig: {refresh: true,zoom: true},columns: [{field: 'brand',title: '品牌',children: [{field: 'code',title: '型号',children: [{field: 'imgUrl',title: '图片',children: [{field: 'describe',title: '价格'}]}]}]},{field: 'product1000',title: '大米科技',children: [{field: 'product1111',title: 'X6',children: [{field: 'product1110',title: '',slots: {header: 'img11'},children: [{field: 'product11',title: '4999',align: 'center',slots: {default: 'cell11'}}]}]},{field: 'product1211',title: 'X6 pro',children: [{field: 'product1210',title: '',slots: {header: 'img12'},children: [{field: 'product12',title: '5999',align: 'center',slots: {default: 'cell12'}}]}]}]},{field: 'product20',title: '遥先科技',children: [{field: 'product2111',title: 'Y8',children: [{field: 'product2110',title: '',slots: {header: 'img21'},children: [{field: 'product21',title: '8999',align: 'center',slots: {default: 'cell21'}}]}]},{field: 'product2211',title: 'Y8 plus',children: [{field: 'product2210',title: '',slots: {header: 'img22'},children: [{field: 'product22',title: '10999',align: 'center',slots: {default: 'cell22'}}]}]}]},{field: 'product30',title: '拼果科技',children: [{field: 'product3111',title: 'T7',children: [{field: 'product3110',title: '',slots: {header: 'img31'},children: [{field: 'product31',title: '7999',align: 'center',slots: {default: 'cell31'}}]}]},{field: 'product3211',title: 'T7 x',children: [{field: 'product3210',title: '',slots: {header: 'img32'},children: [{field: 'product32',title: '8999',align: 'center',slots: {default: 'cell32'}}]}]}]}],data: [{ id: 10000, describe: 'AI智能交互', product11: '基础语音', product12: '神马语音大模型', product21: '基础语音', product22: '饕鬄语音大模型', product31: '基础语音', product32: '宙斯语音大模型' },{ id: 10002, describe: '远程控制', product11: true, product12: true, product21: false, product22: true, product31: false, product32: true },{ id: 10003, describe: '卫星通话', product11: false, product12: true, product21: true, product22: true, product31: false, product32: true },{ id: 10004, describe: '指纹解锁', product11: true, product12: true, product21: true, product22: true, product31: true, product32: true },{ id: 10005, describe: '防水等级', product11: 'IP67', product12: 'IP68', product21: 'IP67', product22: 'IP68', product31: 'IP67', product32: 'IP68' },{ id: 10006, describe: '根据手机壳颜色换主题', product11: false, product12: true, product21: false, product22: false, product31: false, product32: false },{ id: 10007, describe: '水冷散热', product11: false, product12: true, product21: false, product22: false, product31: false, product32: false },{ id: 10008, describe: '信号加强', product11: true, product12: true, product21: true, product22: true, product31: true, product32: true },{ id: 10009, describe: '蓝牙通话', product11: false, product12: true, product21: true, product22: true, product31: true, product32: true },{ id: 10010, describe: '无线对讲', product11: false, product12: true, product21: true, product22: true, product31: true, product32: false },{ id: 10011, describe: '重量', product11: '249克', product12: '282克', product21: '238克', product22: '256克', product31: '226克', product32: '244克' },{ id: 10012, describe: '屏幕分辨率', product11: '2k', product12: '4k', product21: '2k', product22: '4k', product31: '2k', product32: '2k' },{ id: 10013, describe: '拍照像素', product11: '5000万', product12: '1亿', product21: '5000万', product22: '8000万', product31: '3000万', product32: '5000万' },{ id: 10014, describe: '自动报警', product11: false, product12: true, product21: true, product22: true, product31: false, product32: true },{ id: 10015, describe: '无线支付', product11: true, product12: true, product21: true, product22: true, product31: false, product32: true },{ id: 10016, describe: '游戏模式', product11: true, product12: true, product21: true, product22: true, product31: true, product32: true },{ id: 10017, describe: '杜比音效', product11: false, product12: true, product21: true, product22: true, product31: true, product32: true },{ id: 10018, describe: '智能居家', product11: true, product12: true, product21: true, product22: true, product31: true, product32: true },{ id: 10019, describe: 'wifi8', product11: true, product12: true, product21: true, product22: true, product31: true, product32: true },{ id: 10020, describe: '无线充电', product11: true, product12: true, product21: true, product22: true, product31: true, product32: true }]
})const hasCheckboxCell = (cellValue) => {if (XEUtils.isBoolean(cellValue)) {return true}return false
}
</script>

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。
如若转载,请注明出处:http://www.pswp.cn/diannao/88725.shtml
繁体地址,请注明出处:http://hk.pswp.cn/diannao/88725.shtml
英文地址,请注明出处:http://en.pswp.cn/diannao/88725.shtml

如若内容造成侵权/违法违规/事实不符,请联系英文站点网进行投诉反馈email:809451989@qq.com,一经查实,立即删除!

相关文章

【CF】Day85——CF 1033 (Div. 2) B (物理?) + CF 860 (Div. 2) C (数学思维 + lcm + gcd)

忙于期末&#xff0c;久久未写&#xff0c;今日一写&#xff0c;全都忘了 C. Candy Store 题目&#xff1a; 思路&#xff1a; 数学思维 我们假设一个标签 cost 可以覆盖一个连续的区间&#xff0c;那么这个 cost 就满足 cost bl * dl bl1 * dl1 ... br-1 * dr-1 br * d…

16.2 Docker多阶段构建实战:LanguageMentor镜像瘦身40%,支持500+并发1.2秒响应!

LanguageMentor Agent 容器化部署与发布:Docker 镜像创建与测试 关键词:Docker 容器化部署, 多阶段构建, 镜像分层优化, 环境一致性, 私有化模型集成 1. Dockerfile 最佳实践架构设计 通过多阶段构建策略实现开发与生产环境分离: #mermaid-svg-CKUsKERUN6nqM0bI {font-fam…

高可用与低成本兼得:全面解析 TDengine 时序数据库双活与双副本

在现代数据管理中&#xff0c;企业对于可靠性、可用性和成本的平衡有着多样化的需求。为此&#xff0c;TDengine 在 3.3.0.0 版本中推出了两种不同的企业级解决方案&#xff1a;双活方案和基于仲裁者的双副本方案&#xff0c;以满足不同应用场景下的特殊需求。本文将详细探讨这…

Github项目:Python编写的录屏工具 TTvideo(已打包)

打包好能立即用的github项目&#xff1a;TTvideo 用的github上的项目&#xff1a;https://github.com/jumppppp/ttvideo 朴实无华&#xff0c;功能强大的录屏工具 原作者如有认为侵权&#xff0c;评论区联系立删 1.效果图 2.下载链接 录屏工具

LE AUDIO---Chapter 2. The Bluetooth® LE Audio architecture

目录 2.1 The use cases 2.1.1 Hearing aid requirements - the use cases 2.1.1.1 Basic telephony 2.1.1.2 Low latency audio from a TV 2.1.1.3 Adding more users 2.1.1.4 Adding more listeners to support larger areas 2.1.1.5 Coordinating left and right hearin…

算法第54天| 并查集

107. 寻找存在的路径 题目 思路与解法 #include <iostream> #include <vector> using namespace std;int n; // 节点数量 vector<int> father vector<int> (101, 0); // 按照节点大小定义数组大小// 并查集初始化 void init() {for (int i 1; i &l…

守护API可用性:全面对抗DDoS与CC洪水攻击策略

API的可用性直接关系到用户体验和业务收入。分布式拒绝服务&#xff08;DDoS&#xff09;和针对应用层的CC&#xff08;Challenge Collapsar&#xff09;攻击&#xff0c;旨在耗尽服务器资源&#xff08;带宽、连接数、CPU&#xff09;&#xff0c;使合法用户无法访问。这类攻击…

第 4 章:第一个神经网络实战——使用 PyTorch

第 4 章&#xff1a;第一个神经网络实战——使用 PyTorch 经过前三章的学习&#xff0c;我们已经对神经网络的理论基础有了扎实的理解。我们知道数据如何前向传播&#xff0c;如何用损失函数评估预测&#xff0c;以及如何通过梯度下降和反向传播来更新网络参数。 理论是根基&a…

MST56XXB/MST5650B/MST5033B 是一款耐高压的LDO芯片,针对中控设备,给MCU供电,60V的耐压,150mA

MST56XXB系列是一款高输入电压(60V)低静态电流、高PSRR线性稳压器(LDO)&#xff0c;能够提供150mA负载电流。LDO针对线电压瞬变和负载电流瞬变具有非常快速的响应特性&#xff0c;并确保LDO启动期间和短路恢复过程中不会出现过冲电压。该设备具有集成的短路和热关断保护。该设备…

Java基础(五):流程控制全解析——分支(if/switch)和循环(for/while)的深度指南

Java基础系列文章 Java基础(一)&#xff1a;发展史、技术体系与JDK环境配置详解 Java基础(二)&#xff1a;八种基本数据类型详解 Java基础(三)&#xff1a;逻辑运算符详解 Java基础(四)&#xff1a;位运算符详解 Java基础(五)&#xff1a;if/switch与for/while - 深入理解…

面向对象概述

1 面向过程程序设计 面向过程是最为实际的一种思考方式&#xff0c;面向对象的方法也是含有面向过程的思想&#xff0c;面向过程是一种基础的方法。它考虑的是实际的实现&#xff0c;一般的面向过程是从上往下步步求精。面向过程最重要的是模块化的思想方法。对比面向对象&…

linux dts overlay

设备树 Overlay&#xff08;Device Tree Overlays, DTO&#xff09;&#xff0c;它在嵌入式Linux系统&#xff08;尤其是基于ARM的设备&#xff0c;比如树莓派、NanoPi等&#xff09;中非常常见。它主要用于动态修改设备树&#xff0c;以适配硬件的变化或扩展外设支持。 1. 设备…

ArkUI-X的声明式语法转换过程

以下是ArkUI-X声明式语法转换过程的详细解析&#xff0c;结合其核心设计原理与实现机制&#xff1a; ‌一、基础语法转换规则 组件声明转换 传统命令式组件创建&#xff08;如Android XMLJava&#xff09;转换为ArkUI-X的Component结构&#xff1a; // 命令式&#xff08;A…

Docker 入门教程(一):从概念到第一个容器

文章目录 &#x1f433; Docker 入门教程&#xff08;一&#xff09;&#xff1a;从概念到第一个容器1. Docker 是什么&#xff1f;2. Docker 的核心概念3. 安装 Docker4. 运行你的第一个 Docker 容器 &#x1f433; Docker 入门教程&#xff08;一&#xff09;&#xff1a;从概…

如何在 Vue 应用中嵌入 ONLYOFFICE 编辑器

以下是仅包含 纯前端集成 ONLYOFFICE 文档编辑器到 Vue.js 项目 的完整代码与说明&#xff0c;无需重新创建项目&#xff0c;可直接集成到现有 Vue 项目中&#xff1a; Vue.js 集成 ONLYOFFICE 文档编辑器&#xff08;纯前端实现&#xff09; 后端需要部署到服务器&#xff0c…

Cursor 1.0 炸裂功能:在后台运行多个Agent,释放双手

Cursor 1.0 版本更新了用于代码审查的 BugBot、对内存、一键式 MCP 设置、Jupyter 支持以及 Background Agent 的正式发布。 今天这篇文章主要介绍 Background Agent 的使用教程。 文章目录 1. Background Agent 的基本概念2. 后台 Agent 的使用方法3. 让后台 Agent 创造一个简…

MLX LM - 在Apple芯片上运行大语言模型的Python工具包

文章目录 一、关于MLX LM1、项目概览2、相关链接资源3、功能特性 二、安装配置三、使用指南1、快速开始2、Python API3、量化模型&#xff0c;上传HF4、流式生成采样 5、命令行6、长提示词与生成 四、支持模型大模型 一、关于MLX LM 1、项目概览 MLX LM是一个Python工具包&am…

【git学习】学习目标及课程安排

Git 是一款非常强大的版本控制工具&#xff0c;掌握它对编程和团队协作都有巨大帮助。 &#x1f3af;学习目标&#xff08;适合个人与团队使用&#xff09; 理解 Git 和版本控制的基本概念 熟练使用 Git 进行代码提交、分支管理、合并与冲突解决 掌握远程仓库协作流程&#x…

HDFS(Hadoop分布式文件系统)总结

文章目录 一、HDFS概述1. 定义与定位2. 核心特点 二、HDFS架构核心组件1. NameNode&#xff08;名称节点&#xff09;2. DataNode&#xff08;数据节点&#xff09;3. Client&#xff08;客户端&#xff09;4. Secondary NameNode&#xff08;辅助名称节点&#xff09; 三、数据…

破局与融合:破解开发与供应链安全的业务场景难题

数字化转型下的安全新范式与融合挑战 在数字化浪潮的席卷下&#xff0c;企业正全面拥抱云计算、微服务、容器化和开源技术。这种转型在极大提升业务敏捷性的同时&#xff0c;也带来了全新的安全挑战&#xff1a;传统网络边界消融&#xff0c;攻击面急剧扩大&#xff0c;“开发安…