更新记录
1.0.0(2023-09-04)
平台兼容性
App |
快应用 |
微信小程序 |
支付宝小程序 |
百度小程序 |
字节小程序 |
QQ小程序 |
HBuilderX 3.6.8,Android:不支持,iOS:11,HarmonyNext:不确定 |
× |
× |
× |
× |
× |
× |
钉钉小程序 |
快手小程序 |
飞书小程序 |
京东小程序 |
× |
× |
× |
× |
H5-Safari |
Android Browser |
微信浏览器(Android) |
QQ浏览器(Android) |
Chrome |
IE |
Edge |
Firefox |
PC-Safari |
× |
× |
× |
× |
× |
× |
× |
× |
× |
sn-uts-appicon
暂时仅支持iOS
使用
ios配置
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>CFBundleIcons</key>
<dict>
<key>CFBundleAlternateIcons</key>
<dict>
<key>Test1</key>
<dict>
<key>CFBundleIconFiles</key>
<array>
<string>Test1</string>
</array>
<key>UIPrerenderedIcon</key>
<false />
</dict>
<key>Test2</key>
<dict>
<key>CFBundleIconFiles</key>
<array>
<string>Test2</string>
</array>
<key>UIPrerenderedIcon</key>
<false />
</dict>
</dict>
</dict>
</dict>
</plist>
nativeResources/
└── ios
└── Resources
├── Test1@2x.png
├── Test1@3x.png
├── Test2@2x.png
└── Test2@3x.png
引入
import * as AppIconUtil from '@/uni_modules/sn-uts-appicon'
是否支持动态设置icon
let isSupport = AppIconUtil.supportsAlternateIcons()
获取当前icon
let lastIcon = AppIconUtil.getAppIcon()
设置
AppIconUtil.setAppIcon("Test1", e => {
console.log('setAppIcon', e)
})