关于vue树形表格的实现-vxe-table

本文介绍了如何在Vue应用中安装VXE-Table库,包括必要的导入步骤,并详细展示了如何配置和使用VXE-Tableresizable组件,包括列定义和操作列的模板。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

1、安装

 npm install xe-utils@3 vxe-table@3
 import 'xe-utils'
 import VXETable from 'vxe-table'
 import 'vxe-table/lib/style.css'

 Vue.use(VXETable)

2、使用
html:

<vxe-table resizable
                   border
                   ref="xTable"
                   :tree-config="{transform: true, rowField: 'id', parentField: 'pid'}"
                   :data="tableData"
                   style="margin-top: 0.3rem">
          <vxe-column field="name" title="名称" tree-node>
            <template #default="{ row }">
              <i v-if="row.children.length>0"  class=" el-icon-folder"></i>
              <i v-else  class="el-icon-document"></i>
              <span style="text-align: left">{{row.name}}</span>
            </template>
          </vxe-column>
          <vxe-column field="funCode" title="系统编码"></vxe-column>
          <vxe-column field="url" title="URL"></vxe-column>
          <vxe-column field="funOrder" title="排序"></vxe-column>
          <vxe-column field="address" title="类型"  >
            <template #default="{ row }">
              <div class="userManagement_content_line">
               <span>{{row.funType==0?'系统':row.funType==1?'菜单':row.funType==2?'菜单项':row.funType==3?'功能模块':""}}</span>
              </div>
            </template>
          </vxe-column>
          <vxe-column field="address" title="操作" width="500">
            <template #default="{ row }">
              <div class="userManagement_content_line2">
                <i class="el-icon-s-tools" v-if="row.funType==2||row.funType==0||row.funType==1||row.funType==3" ">修改</i>
                <i class="el-icon-delete" v-if="row.funType==2||row.funType==0||row.funType==1||row.funType==3" ">删除</i>
                <i class="el-icon-plus" v-if="row.funType==0||row.funType==1" >增加子菜单</i>
                <i class="el-icon-circle-plus-outline" v-if="row.funType==0||row.funType==1" >增加菜单项</i>
                <i class="el-icon-plus" v-if="row.funType==2||row.funType==0||row.funType==1" >增加功能模块</i>
              </div>
            </template>
          </vxe-column>
        </vxe-table>

js:

data() {
      return {
        tableData: [{
		    id: "",
		    name: "",
		    funCode: "",
		    funType: 0,
		    funOrder: 0,
		    url: null,
		    pid: null,
		    sysCode: null,
		    optIds: null,
		    remark: "1234123",
		    openModel: null,
		    funIcon: null
		}],
     }
 }
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

言只 石皮

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值