更新记录
1.0.0(2025-09-29)
平台兼容性
uni-app(4.65)
Vue2 |
Vue3 |
Chrome |
Safari |
app-vue |
app-nvue |
Android |
iOS |
鸿蒙 |
√ |
√ |
× |
× |
√ |
√ |
× |
12 |
× |
微信小程序 |
支付宝小程序 |
抖音小程序 |
百度小程序 |
快手小程序 |
京东小程序 |
鸿蒙元服务 |
QQ小程序 |
飞书小程序 |
快应用-华为 |
快应用-联盟 |
× |
× |
× |
× |
× |
× |
× |
× |
× |
× |
× |
uni-app x(4.65)
Chrome |
Safari |
Android |
iOS |
鸿蒙 |
微信小程序 |
× |
× |
× |
12 |
× |
× |
- 插件dc-changeicon放入项目根目录下的uni_modules文件夹下(没有该文件夹自行创建)
- 配置备用图标,在dc-changeicon/utssdk/app-ios/Resources文件夹下放入备用图标,一套备用图标需要3张分别为60x60、120x120、180x180尺寸的图片,命名3个尺寸的图片名称一样分别以@1x.png/@2x.png/@3x.png结尾(图片需满足苹果要求)插件内有示例,可以最多设置10套不同的图标。
- 配置Info.plist文件详情见截图
- 引入插件 在使用的页面引入插件 import * as ChangeIcon from '../../uni_modules/dc-changeicon' 见示例代码
- 以上步骤做完打自定义基座验证测试
使用--完整示例
<template>
<view class="content">
<view
style="width: 600rpx;height: 80rpx;display: flex;align-items: center;justify-content: center;background-color: aqua;margin: 40rpx;"
@click="change()">
更换图标1</view>
<view
style="width: 600rpx;height: 80rpx;display: flex;align-items: center;justify-content: center;background-color: aqua;margin: 40rpx;"
@click="change2()">
更换更换图标2</view>
<view
style="width: 600rpx;height: 80rpx;display: flex;align-items: center;justify-content: center;background-color: aqua;margin: 40rpx;"
@click="change3()">
恢复</view>
<text>修改结果回调:{{changeResult}}</text>
</view>
</template>
<script>
/**
* 每次修改完图片资源或者Info.plist中的内容(注释除外)都需要重新打基座测试,iOS修改图标系统都会弹框提醒
*/
import * as ChangeIcon from '../../uni_modules/dc-changeicon'
export default {
data() {
return {
changeResult: ""
}
},
onLoad() {
},
methods: {
change() {
//ts或者uniappx项目需要加上类型转换 as ChangeIcon.ChangeIconOption
/**
* 例子
* ChangeIcon.changeIcon({
iconName: "", //需要维护到dc-changeicon->utssdk->app-ios->Info.plist中
complete: (res) => {
this.changeResult = res
}
} as ChangeIcon.ChangeIconOption)
*/
ChangeIcon.changeIcon({
iconName: "standby", //需要维护到dc-changeicon->utssdk->app-ios->Info.plist中
complete: (res) => {
this.changeResult = res
}
})
},
change2() {
//ts或者uniappx项目需要加上类型转换 as ChangeIcon.ChangeIconOption
ChangeIcon.changeIcon({
iconName: "default", //需要维护到dc-changeicon->utssdk->app-ios->Info.plist中
complete: (res) => {
this.changeResult = res
}
})
},
change3() {
//ts或者uniappx项目需要加上类型转换 as ChangeIcon.ChangeIconOption
ChangeIcon.changeIcon({
iconName: "", //需要维护到dc-changeicon->utssdk->app-ios->Info.plist中
complete: (res) => {
this.changeResult = res
}
})
}
}
}
</script>
<style>
.content {
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
}
</style>
注意事项
- 每次修改完Resources或Info.plist都要重新打基座或者打包
- 调用穿的参数iconName需要在Info.plist中维护
- 每次修改系统会弹框提醒(无法去掉)