Merge branch 'dev' into auth

This commit is contained in:
Wang Kejun 2023-08-03 13:57:28 +08:00
commit e5e6efd464
2 changed files with 43 additions and 39 deletions

View File

@ -15,6 +15,7 @@ module.exports = (babel) => {
// this.props.t/this.t/t
// t('common:detail') 不需要处理 t('detail') 需要处理;
// t(`${common}:${cc}`) 不需要处理 t(`${common}cc`) 需要处理
// 只支持t的参数为字符串或模版字符串
if (
/(pages|components)[\w|\W]+(.tsx|.ts|.jsx|.js)$/.test(res)
) {
@ -49,43 +50,6 @@ module.exports = (babel) => {
1,
t.stringLiteral(ns + ':' + node2.value)
);
} else if (
index === 0 &&
t.isIdentifier(node2) &&
node2.name &&
node2.name.indexOf(':') === -1
) {
// t(ele)
arguments.splice(
index,
1,
t.binaryExpression(
'+',
t.stringLiteral(ns + ':'),
t.identifier(node2.name)
)
);
} else if (
index === 0 &&
t.isMemberExpression(node2) &&
node2.object.name &&
node2.object.name.indexOf(':') === -1
) {
// t(ele.label)
arguments.splice(
index,
1,
t.binaryExpression(
'+',
t.stringLiteral(ns + ':'),
t.memberExpression(
t.identifier(
node2.object.name
),
t.identifier(node2.property.name)
)
)
);
} else if (
index === 0 &&
t.isTemplateLiteral(node2) &&
@ -114,6 +78,46 @@ module.exports = (babel) => {
})
);
}
// else if (
// index === 0 &&
// t.isIdentifier(node2) &&
// node2.name &&
// node2.name.indexOf(':') === -1
// ) {
// // t(ele)
// arguments.splice(
// index,
// 1,
// t.binaryExpression(
// '+',
// t.stringLiteral(ns + ':'),
// t.identifier(node2.name)
// )
// );
// } else if (
// index === 0 &&
// t.isMemberExpression(node2) &&
// node2.object.name &&
// node2.object.name.indexOf(':') === -1
// ) {
// // t(ele.label)
// arguments.splice(
// index,
// 1,
// t.binaryExpression(
// '+',
// t.stringLiteral(ns + ':'),
// t.memberExpression(
// t.identifier(
// node2.object.name
// ),
// t.identifier(
// node2.property.name
// )
// )
// )
// );
// }
});
}
}

View File

@ -185,7 +185,7 @@ function getRouter({ projectAlias, path, namespace, routePath, isFirst }) {
if (jsonFileExists) {
const {
navigationBarTitleText,
oakDisablePulldownRefresh = false,
enablePullDownRefresh = true,
} = require(`${relPath}.json`);
meta.push(
t.objectProperty(
@ -196,7 +196,7 @@ function getRouter({ projectAlias, path, namespace, routePath, isFirst }) {
meta.push(
t.objectProperty(
t.identifier('oakDisablePulldownRefresh'),
t.booleanLiteral(oakDisablePulldownRefresh) //默认启用下拉刷新
t.booleanLiteral(!enablePullDownRefresh) //默认启用下拉刷新
)
);
}