在mian.js导入的包如下:该bootstrap-table-treegrid.js需要去下载,在复制到jquery-treegrid/js/

1 import $ from 'jquery'
2 import 'bootstrap/dist/css/bootstrap.min.css'
3 import 'bootstrap/dist/js/bootstrap.min'
4 import 'bootstrap-table/dist/bootstrap-table.min.css'
5 import 'bootstrap-table/dist/bootstrap-table.min'
6 import 'bootstrap-table/dist/locale/bootstrap-table-zh-CN.min'
7 import 'jquery-treegrid/css/jquery.treegrid.css'
8 import 'jquery-treegrid/js/jquery.treegrid.min'
9 import 'jquery-treegrid/js/bootstrap-table-treegrid'

package.json如下:

1 "dependencies": {
2     "bootstrap": "^3.3.7",
3     "bootstrap-table": "^1.11.1",
4     "jquery": "^3.4.1",
5     "jquery-treegrid": "^0.3.0"
6   }

mounted方法如下:

 1 <template>
 2   <div>
 3     <div class="container">
 4       <table id="treeGrid"></table>
 5     </div>
 6   </div>
 7 </template>
 8
 9 <script>
10
11 export default {
12   name: 'function-config',
13   mounted () {
14     // this.$http.get(this.dataUrl).then(resp => {15     //   const options = this.$common.parse(resp)
16     // treeView.init(this.$jquery, options)
17     // })
18     // treeGrid.init(this.$jquery, this.$http, this.$common)
19     let treeGrid = this.$jquery('#treeGrid')
20     this.$http.get('/static/json/system/treeGrid.json').then(resp => {
21       const body = this.$common.parse(resp)
22       treeGrid.bootstrapTable({
23         data: body,
24         striped: true,
25         sidePagination: 'server',
26         idField: 'id',
27         columns: [
28           { field: 'check',
29             checkbox: true,
30             formatter: function (value, row, index) {
31               if (row.check === true) {
32                 // 设置选中
33                 return { checked: true }
34               }
35             }
36           },
37           { field: 'name', title: '名称' },
38           { field: 'status', title: '状态', sortable: true, align: 'center' },
39           { field: 'permissionValue', title: '权限值' }
40         ],
41         // 在哪一列展开树形
42         treeShowField: 'name',
43         // 指定父id列
44         parentIdField: 'pid',
45         // onPostBody  onResetView  onLoadSuccess
46         onResetView: function (data) {
47           treeGrid.treegrid({
48             initialState: 'collapsed',
49             // expanderExpandedClass: 'glyphicon glyphicon-minus',
50             // expanderCollapsedClass: 'glyphicon glyphicon-plus',
51             treeColumn: 1,
52             onChange: function () {
53               treeGrid.bootstrapTable('resetWidth')
54             }
55           })
56         }
57       })
58     })
59   }
60 }
61 </script>
62
63 <style scoped>
64
65 </style>

json数据:

 1 [
 2   {
 3     "id": 1,
 4     "status": 1,
 5     "pid":0,
 6     "name": "用户管理",
 7     "permissionValue": "open:user:manage"
 8   },
 9   {
10     "id": 2,
11     "pid":0,
12     "status": 1,
13     "name": "系统管理",
14     "permissionValue": "open:system:manage"
15   },
16   {
17     "id": 3,
18     "pid": 1,
19     "status": 1,
20     "name": "新增用户",
21     "permissionValue": "open:user:add"
22   },
23   {
24     "id": 4,
25     "pid": 1,
26     "status": 1,
27     "name": "修改用户",
28     "permissionValue": "open:user:edit"
29   },
30   {
31     "id": 5,
32     "pid": 1,
33     "status": 0,
34     "name": "删除用户",
35     "permissionValue": "open:user:del"
36   },
37   {
38     "id": 6,
39     "pid": 2,
40     "status": 1,
41     "name": "系统配置管理",
42     "permissionValue": "open:systemconfig:manage"
43   },
44   {
45     "id": 7,
46     "pid": 6,
47     "status": 1,
48     "name": "新增配置",
49     "permissionValue": "open:systemconfig:add"
50   },
51   {
52     "id": 8,
53     "pid": 6,
54     "status": 1,
55     "name": "修改配置",
56     "permissionValue": "open:systemconfig:edit"
57   },
58   {
59     "id": 9,
60     "pid": 6,
61     "status": 0,
62     "name": "删除配置",
63     "permissionValue": "open:systemconfig:del"
64   },
65   {
66     "id": 10,
67     "pid": 2,
68     "status": 1,
69     "name": "系统日志管理",
70     "permissionValue": "open:log:manage"
71   },
72   {
73     "id": 11,
74     "pid": 10,
75     "status": 1,
76     "name": "新增日志",
77     "permissionValue": "open:log:add"
78   },
79   {
80     "id": 12,
81     "pid": 10,
82     "status": 1,
83     "name": "修改日志",
84     "permissionValue": "open:log:edit"
85   },
86   {
87     "id": 13,
88     "pid": 10,
89     "status": 0,
90     "name": "删除日志",
91     "permissionValue": "open:log:del"
92   }
93 ]

看下图,树型表格始终无法成功渲染,只有bootstrap table的效果,很是郁闷。

结果debug查看,对比在html下的例子,发现了bootstrap-table.min.js版本低了,要v1.12.1,于是替换了bootstrap-table.min.js的内容,重新执行npm run dev。结果如下:

主要js文件地址下载:

<script src="https://cdn.bootcss.com/bootstrap-table/1.12.1/bootstrap-table.min.js"></script>

<script src="https://cdn.bootcss.com/bootstrap-table/1.12.0/extensions/treegrid/bootstrap-table-treegrid.js"></script>

转载于:https://www.cnblogs.com/YuWeiXiF/p/10905101.html

vue下的bootstrap table + jquery treegrid, treegrid无法渲染的问题相关推荐

  1. ABP module-zero +AdminLTE+Bootstrap Table+jQuery权限管理系统第十三节--RBAC模式及ABP权限管理(附赠福利)

    ABP+AdminLTE+Bootstrap Table权限管理系统一期 Github:https://github.com/Jimmey-Jiang/ABP-ASP.NET-Boilerplate- ...

  2. ABP module-zero +AdminLTE+Bootstrap Table+jQuery权限管理系统第十四节--后台工作者HangFire与ABP框架Abp.Hangfire及扩展...

    返回总目录:ABP+AdminLTE+Bootstrap Table权限管理系统一期 HangFire与Quartz.NET相比主要是HangFire的内置提供集成化的控制台,方便后台查看及监控,对于 ...

  3. ABP module-zero +AdminLTE+Bootstrap Table+jQuery权限管理系统第十七节--Quartz与ABP框架Abp.Quar...

    ABP+AdminLTE+Bootstrap Table权限管理系统一期 Github:https://github.com/Jimmey-Jiang/ABP-ASP.NET-Boilerplate- ...

  4. ABP+AdminLTE+Bootstrap Table权限管理系统一期

      初衷    学而时习之,不亦说乎,温顾温知新,可以为师矣.           看懂远不如动手去做,动手做才能发现很多自己不懂的问题,不断的反思和总结,"乐于分享是一种境界的突破&quo ...

  5. 基于jQuery的TreeGrid组件

    /*** @author 陈举民* @version 1.0* @link http://chenjumin.iteye.com/blog/419522*/ TreeGrid = function ( ...

  6. Vue CLI3.0 中使用jQuery 和 Bootstrap

    Vue 中使用 jQuery 和 Bootstrap 不是特别符合 Vue 原生的写法,但是有时候又要用,所以放上我的引入设置,供大家参考. 在 Vue CLI2.0 中引入 jQuery 和 Boo ...

  7. vue引入bootstrap、jquery

    在进行vue的学习,项目中需要引入bootstrap.jquery的步骤. 一.引入jQuery 在当前项目的目录下(就是package.json),运行命令 cnpm install jquery ...

  8. bootstrap table表头错位,火狐浏览器下滚动条挤像素问题解决方案。

    首先这篇文章是一个关于bootstrap table的七零八碎各种bug的内容,后续可能会接着更新编辑. 1:前后端分离项目,后端往往要求前端请求后端时,携带着登陆时后端给你的token. boots ...

  9. Bootstrap风格jQuery下拉菜单插件

    下载地址一款漂亮的Bootstrap风格jQuery下拉菜单插件,可以被附加到任何你想要的元素,可以添加一些表单控件,也可以使用CSS添加图标插入,还可以有固定的HTML. dd:

最新文章

  1. poj1410(线段相交问题判断)
  2. 在Android开发中怎样调用系统Email发送邮件
  3. 用加法器构造能够实现连续加法的电路
  4. svn备份遇到的问题
  5. 破解百度翻译页面api参数加密
  6. 铺砖问题JAVA_java彩色瓷砖编程题分析
  7. 详解如何修改Laravel Auth使用salt和password来认证用户
  8. CCS中的cmd命令文件
  9. 帮助你免于失业的十大软件技术
  10. 2022年iOS最新面试(底层基础)问题答案
  11. ArcGIS10.6表统计数据
  12. 基于云的文档管理软件/文档管理系统(DMS)
  13. Python输出[m,n]既能被3整除又能被7整除的数的个数
  14. 梦见自己准备考计算机一级,梦见自己准备要去考试,却没准备好,心里很焦急是什么兆头...
  15. 马士兵坦克大战学习笔记(一)
  16. stm32 memcpy效率
  17. 蓝桥杯备赛--AcWing 668. 游戏时间2
  18. 个人随意总结知识——数据结构教程(第5版)【李春葆】
  19. oracle查询数据库名、实例名等
  20. php开源采集器,简单PHP采集器 - WangEven的个人空间 - OSCHINA - 中文开源技术交流社区...

热门文章

  1. 【云计算的1024种玩法】回忆经典,用虚拟主机重建复古DZ和无心宠物
  2. mapreduce中设置自定义的输入类,进行文本解析(默认以tab键为分隔符)
  3. PHP 实现无限分类
  4. backup restore On Ubuntu
  5. Espresso小试
  6. 正确生成浮点型的方法,解决sqlachemy Float浮点型的坑,生成float类型时,长度和精度均为0,导致查询不到结果!...
  7. MariaDB 基金会 CEO 宣布将于 10 月 1 日卸任
  8. Linux-find命令应用举例-按时间筛选和删除文件
  9. UIPickerView 修改必须滚动才修改值的bug
  10. 用shell脚本监控系统