const fs = require('fs'); const path = require('path'); // 简单的 1x1 像素 PNG(白色) const whitePixel = Buffer.from([ 0x89, 0x50, 0x4E, 0x47, 0x0D, 0x0A, 0x1A, 0x0A, 0x00, 0x00, 0x00, 0x0D, 0x49, 0x48, 0x44, 0x52, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x08, 0x06, 0x00, 0x00, 0x00, 0x1F, 0x15, 0xC4, 0x89, 0x00, 0x00, 0x00, 0x0A, 0x49, 0x44, 0x41, 0x54, 0x78, 0x9C, 0x63, 0x00, 0x01, 0x00, 0x00, 0x05, 0x00, 0x01, 0x0D, 0x0A, 0x2D, 0xB4, 0x00, 0x00, 0x00, 0x00, 0x49, 0x45, 0x4E, 0x44, 0xAE, 0x42, 0x60, 0x82 ]); // 创建目录 const dir = path.join(__dirname, '..', 'assets', 'tabbar'); if (!fs.existsSync(dir)) { fs.mkdirSync(dir, { recursive: true }); } // 创建占位图标文件 const icons = [ 'home.png', 'home-active.png', 'message.png', 'message-active.png', 'toolbox.png', 'toolbox-active.png', 'user.png', 'user-active.png' ]; icons.forEach(icon => { const filePath = path.join(dir, icon); fs.writeFileSync(filePath, whitePixel); console.log(`Created: ${icon}`); }); console.log('\n占位图标创建完成!请替换为实际图标文件。'); console.log('图标尺寸建议:81x81 像素(微信小程序推荐)');