Browse Source

Pull request #3384: KERNEL-14076 fix: 修复xtype

Merge in VISUAL/fineui from ~TREECAT/fineui:es6 to es6

* commit 'd6e909e8931c0723dffa247765cc507a440fb4fe':
  KERNEL-14076 fix: 修复xtype
es6
treecat-罗群 2 years ago
parent
commit
66c4aa840c
  1. 9
      es6.js

9
es6.js

@ -109,19 +109,20 @@ async function handleFile(srcName) {
const sourceCode = fs.readFileSync(srcName).toString(); const sourceCode = fs.readFileSync(srcName).toString();
const result = /BI\.(.*?)\s\=\sBI\.inherit\(/.exec(sourceCode); const result = /BI\.(.*?)\s=\sBI\.inherit\(/.exec(sourceCode);
if (!result) { if (!result) {
console.log(`已经es6过,替换 xtype => ${srcName}, `); console.log(`已经es6过,替换 xtype => ${srcName}`);
// 处理 xtype // 处理 xtype
// 尝试对 xtype 进行替换 // 尝试对 xtype 进行替换
const noXtypeCode = sourceCode.replace(/"bi\.(.*?)"/g, matchedSentence => { const noXtypeCode = sourceCode.replace(/type:\s?"bi\.(.*?)"/g, v => {
const matchedSentence = v.replace(/type:\s?/, "");
const loadSuccess = loader.load(srcName, matchedSentence); const loadSuccess = loader.load(srcName, matchedSentence);
if (loadSuccess) { if (loadSuccess) {
const clzName = depts[matchedSentence].clzName; const clzName = depts[matchedSentence].clzName;
return `${clzName}.xtype`; return `type: ${clzName}.xtype`;
} else { } else {
console.log(`xtype 替换失败 ${matchedSentence} `); console.log(`xtype 替换失败 ${matchedSentence} `);

Loading…
Cancel
Save