Files
huishou/check-local-weigh.js
2026-07-27 14:07:26 +08:00

40 lines
1.3 KiB
JavaScript

const fs = require('fs');
const path = require('path');
const assetsDir = path.join(__dirname, 'dist', 'build', 'h5', 'assets');
const files = fs.readdirSync(assetsDir);
const weighFile = files.find(f => f.includes('pages-weigh'));
if (weighFile) {
const content = fs.readFileSync(path.join(assetsDir, weighFile), 'utf8');
console.log(`文件: ${weighFile}`);
console.log(`文件大小: ${content.length} bytes`);
const inputModeMatches = content.match(/inputMode/g);
console.log('inputMode出现次数:', inputModeMatches ? inputModeMatches.length : 0);
const manualMatches = content.match(/manual/g);
console.log('manual出现次数:', manualMatches ? manualMatches.length : 0);
const bluetoothMatches = content.match(/bluetooth/g);
console.log('bluetooth出现次数:', bluetoothMatches ? bluetoothMatches.length : 0);
// 搜索相关代码上下文
const regex = /inputMode[^,;]+/g;
let match;
console.log('\ninputMode相关代码:');
while ((match = regex.exec(content)) !== null) {
console.log(match[0]);
}
// 搜索ref定义
const refRegex = /ref\(['"]inputMode['"]\)[^,;]+/g;
console.log('\nref定义:');
let refMatch;
while ((refMatch = refRegex.exec(content)) !== null) {
console.log(refMatch[0]);
}
} else {
console.log('没有找到称重页面JS文件');
}