EXTJS 中页面浏览错误 ext-all.js:17 Uncaught TypeError: b.getRoot is not a function
1.页面数据以树状层级结构显示,store界面extend:' ' 写法不对会导致页面无法加载显示,报下面错误。
EXTJS 中页面浏览加载错误 ext-all.js:17 Uncaught TypeError: b.getRoot is not a function

1). 原因是 store 中的extend: ' ' 继承写的不对 。
Ext.define('Vstar.store.CORE_DepartmentY', { extend: 'Ext.data.TreeStore', // Ext.data.TreeStore 这种写法是正确的,且ID是 数字 字符串 // extend:'vapp.base.BaseStore', // 页面数据以树状层级结构显示,以这种写法继承,就会报上图错误信息,导致页面加载不出来,而且id是guid字符串 requires: ['Vstar.model.CORE_DepartmentY'], storeId: 'CORE_DepartmentY', model: 'Vstar.model.CORE_DepartmentY', autoLoad: false, rootVisible: false, root: { Name:'组织机构', Code:'组织机构', PathId: 'root', ID: 'root', expand:true } // ...以下内容略 });
2).还有就是别名写错了,或者是别名重复了。 xtype: ' ' 或者 alias: ' '
(1)下面错误信息就是我把mainView中的别名和mainController中的别名写重复了,导致如下报错
(2)store名称定义写错了,Ext.define('Vstar.store.CORE_DictionaryDataYTree',{}) 与ListView中创建store写的名称不一致

2. Uncaught SyntaxError: Invalid shorthand property initializer
在浏览器调试运行时出现错误:Uncaught SyntaxError: Invalid shorthand property initializer。
原因是“=”应该写为“:”这个经常错,还不容易发现。

3.Uncaught TypeError: Cannot read properties of undefined (reading ‘length‘)
在浏览器调试运行时出现错误:Uncaught TypeError: Cannot read properties of undefined (reading ‘length')

原因是 region:'center' 写成了region: 'cneter' 所以报上面错误。

4. 参数位置写反了,也会导致报错


5. Uncaught SyntaxError: Unexpected end of input 解决办法

Unexpected end of input 的英文意思是“意外的终止输入”。
这行报错一般是代表我们的浏览器在读取我们js代码时,碰到了不可预知的错误,导致浏览器 无法进行下面的读取。造成的原因可能是:
1.页面代码写的不规范..........其中的某条语句,没有正常结束;
2.或者部分语句“ ‘ ’ ” 双引号,单引号没有配对好,被转义了之类的......错误造成的...;
3.是应该成双的符号输入错误,比如说“ ”, ‘ ’, { },[ ] , ( ) ..........
6. Uncaught TypeError: c is not a constructor 报错信息
原因是 xtype 写错了,写成xytpe了。


浙公网安备 33010602011771号