zTree_v3 icon indicating copy to clipboard operation
zTree_v3 copied to clipboard

ztree chrome显示问题

Open 240668488 opened this issue 10 years ago • 11 comments

ztree在chrome浏览器下报错 Uncaught TypeError: Cannot read property 'maxHeight' of undefined 请问如何解决,其他浏览器都正常显示,谢谢

240668488 avatar Apr 01 '16 06:04 240668488

请确认是否 由 zTree 报出的错误? 具体哪一行代码? 是否有测试案例?

zTree avatar Apr 01 '16 06:04 zTree

jquery.ztree.all.js 里面的 1571行,其实就是 识别不了maxHeight 这个属性

240668488 avatar Apr 01 '16 06:04 240668488

不是识别不了maxHeight 而是 你的环境中 document.body.style 为 undefined 导致, 请你尝试用 chrome 去看我 提供的标准 demo 是否会报错? 请检查你环境中的 document.body 为何会导致 document.body.style 为 undefined

zTree avatar Apr 01 '16 07:04 zTree

好的,谢谢你了,有问题再请教你哈!

240668488 avatar Apr 01 '16 07:04 240668488

你好 那个 demo.css 是必须要的么?

240668488 avatar Apr 01 '16 07:04 240668488

好像贴部分代码 显示不了

那个 demo.css也没有对这个 maxHeight 属性的描述

240668488 avatar Apr 01 '16 07:04 240668488

1、demo.css 是demo 页面用到的, 对于项目中不是必需的 2、document.body.style 是 undefined,你不应该去检查 css, 应该去检查 js 自己输出你的 document.body; document.body.style 看看是什么

zTree avatar Apr 01 '16 10:04 zTree

你好 我调查了下 火狐浏览器 的输出为 object CSS2Properties IE内核浏览器的输出为 object MSStyleCssProperties 谷歌浏览器的输出为 undefined 我想知道的是 ztree你有在chrome 上面运行过么? 谢谢

240668488 avatar Apr 05 '16 03:04 240668488

我后来看了下 ztree提供的demo 可以在chrome 上面运行显示 但不知道我的为什么不可以,其他浏览器都是正常的,就是chrome 不行

240668488 avatar Apr 05 '16 03:04 240668488

你好, 我前面跟你说过,你要去检查你的页面中 document.body 是什么, 检查你的代码,是不是有什么全局变量叫做 body,把 document.body 给替换了??

zTree avatar Apr 05 '16 03:04 zTree

哈哈哈,太感谢了 我那个页面有个div 的id 叫body,我怀疑谷歌读的document.body 变成读这个div了 其他浏览器倒不会,问题解决了,谢谢哈

240668488 avatar Apr 05 '16 03:04 240668488