更新记录
1.0.0(2025-03-02)
平台兼容性
App |
快应用 |
微信小程序 |
支付宝小程序 |
百度小程序 |
字节小程序 |
QQ小程序 |
HBuilderX 4.45,Android:5.0,iOS:不支持,HarmonyNext:不支持 |
× |
× |
× |
× |
× |
× |
钉钉小程序 |
快手小程序 |
飞书小程序 |
京东小程序 |
鸿蒙元服务 |
× |
× |
× |
× |
× |
H5-Safari |
Android Browser |
微信浏览器(Android) |
QQ浏览器(Android) |
Chrome |
IE |
Edge |
Firefox |
PC-Safari |
× |
× |
× |
× |
× |
× |
× |
× |
× |
概述
- 支持控制悬浮窗自定义显示(支持多个显示),隐藏,修改,位置,尺寸,拖动
- 支持悬浮窗点击事件
- 支持悬浮窗显示到应用外
温馨提示 如何调用插件
复制代码 import {
initIcon,
showIcon,
hideIcon,
changeIcon,
getResourcePath
} from "@/uni_modules/yuange-floatwindow"
初始化
复制代码let p = {
widthRatio: this.widthRatio,
heightRatio: this.heightRatio,
xRatio: this.xRatio,
yRatio: this.yRatio,
moveType: this.moveType,
slideLeftMargin: this.slideLeftMargin,
slideRightMargin: this.slideRightMargin,
duration: this.duration,
tag: this.tag,
iconPath: getResourcePath('logo.png')
};
initIcon(JSON.stringify(p), {
success(res) {
console.log(JSON.stringify(res));
},
fail(err) {
console.log(JSON.stringify(err));
}
});
显示悬浮窗
复制代码 let p = {
tag: this.tag
};
showIcon(JSON.stringify(p), {
success(res) {
console.log(JSON.stringify(res));
},
fail(err) {
console.log(JSON.stringify(err));
}
});
隐藏悬浮窗
复制代码 let parm = {
tag: this.tag
}
hideIcon(JSON.stringify(parm), {
success(res) {
console.log(JSON.stringify(res));
},
fail(err) {
console.log(JSON.stringify(err));
}
});
修改悬浮窗
复制代码
const staticPath = getResourcePath('logo.png')
console.log('static路径:', staticPath);
let parm = {
tag: this.tag,
iconPath: staticPath
}
changeIcon(JSON.stringify(parm), {
success(res) {
console.log(JSON.stringify(res));
},
fail(err) {
console.log(JSON.stringify(err));
}
});