uniapp-vue3-table:基于uni-app+vue3跨端自定義表格table組件
最新研發uniapp+vue3跨端自定義表格table組件|uni-app增強版table
uni-vue3-table:基于uniapp+vue3全端通用自定義加強版table組件。支持固定表頭/列、邊框、斑馬紋、單選/多選,自定義表頭/表體內容插槽、左右固定列陰影高亮。支持編譯運行web+小程序端+app端。
編譯運行到H5+小程序+App端。

uniapp-vue3-os手機oa系統|uni-app+vue3跨三端os后臺管理模板

uni-vue3-table表格組件修復當列數過多,左右滾動會導致固定在左側/右側列也會隨著一起滾動問題。

uniapp+vue3自定義表格

將uv3-table組件放在components目錄,在頁面template中即可直接使用。
- Props參數

- columns列參數
/** * 列參數 * @params {string} background 對應列背景色 * @params {string} type 對應列類型(多選selection 索引index) * @params {string} label 顯示的列標題 * @params {string} prop 對應的列字段名 * @params {string} align 列水平對齊方式(left center right) * @params {number|string} width 對應列寬度 * @params {boolean|string} fixed 該列固定到左側(fixed:true|'left')或右側(fixed:'right') * @params {string} columnStyle 對應列自定義樣式 * @params {string} className/class 表格列的類名className */
- 事件
@headerClick 點擊表頭
@rowClick 點擊行觸發
@select 多選/單選
- 自定義插槽
headerCell 自定義表頭內容
default 默認表體內容
empty 無數據插槽

uni-vue3-table使用示例
- 模擬數據
<script setup> import { ref } from 'vue' import Mock from 'mockjs' // 表格數據 const data = ref(Mock.mock({ total: 100, page: 1, pagesize: 10, 'list|20': [ { id: '@id()', author: '@cname()', title: '@ctitle(10, 50)', image: 'https://picsum.photos/400/400?random=' + '@guid()', switch: '@boolean()', 'tags|1': ['admin', 'test', 'dev'], rate: '@integer(1, 5)', date: '@datetime()', color: '@color()', } ] })) // 表格列 const columns = ref([ {type: 'selection', align: 'center', width: 80, fixed: true}, // 多選 {type: 'index', label: 'ID', align: 'center', width: 80, fixed: true}, // 索引序號 {prop: 'author', label: '作者', align: 'center', width: 120}, {prop: 'title', label: '標題', align: 'left', width: '350px'}, {prop: 'image', label: '圖片', align: 'center', width: '120px'}, {prop: 'switch', label: '推薦', align: 'center', width: 100}, {prop: 'tags', label: '標簽', align: 'center', width: 100}, {prop: 'rate', label: '評分', align: 'center', width: 200}, {prop: 'date', label: '發布時間', align: 'left', width: '250px'}, // 時間 {prop: 'date', label: '更新時間', align: 'left', width: '250px'}, // 時間 {prop: 'action', label: '操作', align: 'center', width: 150, fixed: 'right'}, // 操作 ]) </script>
- 基本用法
<uv3-table :columns="columns" :dataSource="data.list" />
- 自定義表格條紋/顏色、高度
<uv3-table :columns="columns" :dataSource="data.list" stripe stripeColor="#eee" padding="5px" height="300px" />
- 綜合用法(固定左側/右側列、自定義表頭/表體插槽、表格事件)
<uv3-table :dataSource="data.list" :columns="columns" :headerBold="true" headerBackground="#ecf5ff" stripe border padding="5px" maxHeight="500px" @rowClick="handleRowClick" @select="handleSelect" > <!-- 自定義header插槽內容 --> <template #headerCell="{ key, col, index }"> <template v-if="key == 'title'"> <view class="flex-c">{{col.label}} <input placeholder="搜索" /></view> </template> <template v-else-if="key == 'date'"> <uni-icons type="calendar"></uni-icons> {{col.label}} </template> <template v-else>{{col.label}}</template> </template> <!-- 自定義body插槽內容(由于小程序不支持動態:name插槽,通過key標識l來自定義表格內容) --> <template #default="{ key, value, row, col, index }"> <template v-if="key == 'image'"> <uv-image :src="value" lazyLoad observeLazyLoad width="80rpx" height="80rpx" @click="previewImage(value)" /> </template> <template v-else-if="key == 'switch'"> <switch :checked="value" style="transform:scale(0.6);" /> </template> <template v-else-if="key == 'tags'"> <uv-tags :text="value" :color="row.color" :borderColor="row.color" plain size="mini" /> </template> <template v-else-if="key == 'rate'"> <uni-rate :value="value" size="14" readonly /> </template> <template v-else-if="key == 'action'"> <uni-icons type="compose" color="#00aa7f" @click="handleEdit(row)" /> <uni-icons type="trash" color="#ff007f" style="margin-left: 5px;" @click="handleDel(row)" /> </template> <template v-else>{{value}}</template> </template> </uv3-table>






uni-vue3-table表格組件已經更新到我的原創作品集。
綜上就uniapp+vue3自定義表格組件的一些知識分享,感謝大家的閱讀與支持。
附上幾個最新項目實例
uniapp-vue3-os手機oa系統|uni-app+vue3跨三端os后臺管理模板
最新版uni-app+vue3+uv-ui跨三端仿微信app聊天應用【h5+小程序+app端】
Flutter3-MacOS桌面OS系統|flutter3.32+window_manager客戶端OS模板
最新研發flutter3.27+bitsdojo_window+getx客戶端仿微信聊天Exe應用
最新版uniapp+vue3+uv-ui跨三端短視頻+直播+聊天【H5+小程序+App端】
Uniapp-DeepSeek跨三端AI助手|uniapp+vue3+deepseek-v3流式ai聊天模板
Electron35-DeepSeek桌面端AI系統|vue3.5+electron+arco客戶端ai模板
vue3-webseek網頁版AI問答|Vite6+DeepSeek+Arco流式ai聊天打字效果
flutter3-dymall仿抖音直播商城|Flutter3.27短視頻+直播+聊天App實例
Tauri2.0+Vite5聊天室|vue3+tauri2+element-plus仿微信|tauri聊天應用


浙公網安備 33010602011771號