vue引入vue-table-with-tree-grid使用

在做项目过程中需要用的嵌套的表格就想到到了黑马之前用的,站在别人肩膀上可以少走很多歪路。
1.安装
不足开发依赖和运行依赖区别
2.vuecli3
main.js

import TreeTable from 'vue-table-with-tree-grid'
// 组件全局注册 表格树
Vue.component('tree-table', TreeTable)
 <!-- 表格 -->
      <tree-table
        border
        :data="menuTreeData" //数据
        :columns="columns"  //列表内容
        show-header
        :show-index="true" //索引
        :stripe="true"//样式
        show-row-hover
        :expand-type="false" 
        :is-fold="false" //子节点是否折叠
      >
        <!-- 操作 -->
        <template slot="opt" slot-scope="scope">
          <!-- {{scope.row.menuId}} -->
          <el-button
            type="primary"
            icon="el-icon-edit"
            size="mini"
            @click="onResource(scope.row.menuId)"
            >附件</el-button
          >
          <el-button
            type="warning"
            icon="el-icon-edit"
            size="mini"
            @click="onTextResource(scope.row.menuId)"
            >介绍</el-button
          >
          <el-button
            type="info"
            icon="el-icon-edit"
            size="mini"
            @click="onEditDialog(scope.row)"
            >编辑</el-button
          >
         
        </template>
        <!-- 操作状态 -->
        <template slot="operStatus" slot-scope="scope">
          <!-- {{scope.row.operStatus}} -->
          <!-- <el-switch v-if="scope.row.operStatus"  active-color="green" inactive-color="red"></el-switch> -->
     
           <div class="success" v-if="scope.row.operStatus===1"></div>
           <div class="error" v-else></div>
        </template>
        <!-- 展示状态 -->
        <template slot="showStatus" slot-scope="scope">
        
          <div class="success" v-if="scope.row.showStatus===1"></div>
           <div class="error" v-else></div>
        </template>
      </tree-table>
   columns: [
        {
          label: "层级",
          prop: "cc",
        },
        {
          label: "名称",
          prop: "name",
        },
        {
          label: "图标",
          prop: "icon",
        },
        {
          label: "地图编号",
          prop: "mapNumber",
        },
        {
          label: "操作状态",
          type: "template",
          template: "operStatus",
        },
        {
          label: "展示状态",
          //  prop: 'showStatus'
          type: "template",
          template: "showStatus",
        },
        //  {
        //  label: '父编号',
        //  prop: 'parentId'
        // },
        {
          label: "操作",
          width: "400px",
          type: "template",
          template: "opt",
        },
      ],
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值