lin-ui
lin-ui copied to clipboard
calendar组件按需加载的构建错误
设备型号:
all
LinUI 版本:
0.9.4
微信小程序基础库版本:
all
问题描述及重现步骤:
按照文档在config中添加calendar组件,运行npm run build后, Calendar目录下未build出其所有的components文件及内容
相关截图:
补充说明
修改build/until.js中的forParams函数可得到期待结果
const forParams = (arr) => {
let finishArr = [];
arr.map(item => {
let data = fs.readFileSync(`../src/${item}/index.json`, 'utf-8');
const params = JSON.parse(data);
const {
usingComponents
} = params;
if (usingComponents && !isEmptyObj(usingComponents)) {
for (let [key, path] of Object.entries(usingComponents)) {
if (key.startsWith('l-')) {
key = key.substring(2, key.length);
} else {
key = formatKeyByPath(path, item)
}
finishArr.push(key);
}
componentArr.push(...finishArr);
forParams(finishArr);
}
});
};
const formatKeyByPath = (path, parent) => {
path = path.startsWith('./') ? path.replace('./', '').replace('/index', '') : path.replace('/index', '')
return parent + '/' + path
}
相关截图
有兴趣的话可以提一个pr 大家一起共建❤️