如何使用 vue vxe-table 來實現一個產品對比表表格

如何使用 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;“開發安…