EXTJS7 classic tabpanel增加页签报错Error: Invalid component “itemId“

2021-12-07 16:20:29 浏览数 (1)

版本

7.4.0 classic

原因

extjs对组件属性id,itemId存在格式校验。以字母或下划线开始,后面可跟随字母,下划线,数字或连字符

Valid identifiers start with a letter or underscore and are followed by (optional) additional letters, underscores, digits or hyphens.

源码

  • ext-classic/src/Component.js
代码语言:javascript复制
constructor: function(config) {
	if (!me.validIdRe.test(me.id)) {
       Ext.raise('Invalid component "id": "'   me.id   '"');
    }

    if (!me.validIdRe.test(me.itemId)) {
        Ext.raise('Invalid component "itemId": "'   me.itemId   '"');
    }
},
...
validIdRe: Ext.validIdRe, // 默认值为 /^[a-z_][a-z0-9-_]*$/i

0 人点赞