vue展示json -Vue3 通过JSON渲染el-table-column生成完整el-table - 创建ColumnHandle

📅 2026-12-01 👤 拼多多助力营销技巧 📂 拼多多助力神器 👁️ 519 次阅读

功能实现背景

通过Vue3实现后台管理项目一定含有表格功能,基于简单的字段渲染有时候想通过JSON配置来提高开发效率

注意:

1.项目依赖element-plus

使用规则

ColumnRenderProp中key用于:v-for需要的唯一标识ColumnRenderProp中props用于:继承 el-table-column 所有属性 & 自定义属性ColumnRenderProp中type用于:常在项目中出现且需要转换的字段如时间、钱等等,可自行追加ColumnRenderProp中Component用于:自定义组件ColumnRenderProp中render用于:自定义渲染函数columns中优先级排序 component < render < type < props

项目代码

创建type/index.ts文件

export interface ColumnRenderProp {

key?: string // 遍历使用key

props?: Record// 继承 el-table-column 所有属性 & 自定义属性

type?: 'date' // 常用格式的 el-table-column

component?: Component // 自定义组件

render?: Function // 渲染函数

}

创建ColumnRender.vue文件 拼多多帮助力入口

创建ColumnState.vue文件 => 自定义组件

创建ColumnHandle.vue文件 => 自定义组件

实现代码

标签: 拼多多助力网站平台 赚钱项目 拼多多助力网 首码项目 手赚APP
拼多多助力营销技巧