更新记录

1.0.0(2022-08-03)

新版首发


平台兼容性

Android iOS
× 适用版本区间:9 - 16

原生插件通用使用流程:

  1. 购买插件,选择该插件绑定的项目。
  2. 在HBuilderX里找到项目,在manifest的app原生插件配置中勾选模块,如需要填写参数则参考插件作者的文档添加。
  3. 根据插件作者的提供的文档开发代码,在代码中引用插件,调用插件功能。
  4. 打包自定义基座,选择插件,得到自定义基座,然后运行时选择自定义基座,进行log输出测试。
  5. 开发完毕后正式云打包

付费原生插件目前不支持离线打包。
Android 离线打包原生插件另见文档 https://nativesupport.dcloud.net.cn/NativePlugin/offline_package/android
iOS 离线打包原生插件另见文档 https://nativesupport.dcloud.net.cn/NativePlugin/offline_package/ios

注意事项:使用HBuilderX2.7.14以下版本,如果同一插件且同一appid下购买并绑定了多个包名,提交云打包界面提示包名绑定不一致时,需要在HBuilderX项目中manifest.json->“App原生插件配置”->”云端插件“列表中删除该插件重新选择


KJ-FloatWindow

使用

<template>
    <view class="content">
        <KJ-FloatWindow class="floatWindow" ref="floatWindow" @onNotification="onNotification"
            @gingDidBegan="gingDidBegan" @gingDidChanged="gingDidChanged"
            @gingDidEnded="gingDidEnded">
            <view ref="box" class="floatWindowContent" id="floatWindowContent">
                <text>我是全局浮窗</text>
                <text>{{content}}</text>
                <image src="https://img-cdn-tc.dcloud.net.cn/uploads/avatar/000/73/57/99_avatar_max.jpg?v=1652751980"
                    style="width: 50px;height: 50px;"></image>
                <button type="primary" @click="close">关闭</button>
            </view>
        </KJ-FloatWindow>
        <view class="btns">
            <button type="primary" @click="open">打开</button>
            <button type="primary" @click="isOpen">是否打开</button>
            <button type="primary" @click="bringSubviewToFront">浮窗置顶</button>
            <button type="primary" @click="updateLayout">改变位置大小</button>
            <button type="primary" @click="closeWindowAllSubView">关闭window所有子view</button>
            <button type="primary" @click="xiugai">更新浮窗</button>
            <button type="primary" @click="tiaozhuan">跳转</button>
        </view>
        <text style="color: red;">注意:代码便携式的时候,热更新之后,得重启应用</text>
        <text style="color: red;">注意:放浮窗的页面,不能完全清除,否则浮窗会清除</text>
    </view>
</template>

<script>
    export default {
        data() {
            return {
                content: "可更新布局内容"
            }
        },
        onLoad() {
            console.log("onLoad")
        },
        onReady() {
            var arr = [{
                "name": "reviseCotent"
            }, {
                "name": "open"
            }, {
                "name": "close"
            }]
            this.$refs.floatWindow.addNotification(arr) //添加其它页面,发过来的通知
            setTimeout((res) => {
                this.open()
                this.updateLayout()
            }, 1)
        },
        methods: {
            onNotification(res) { //接收其它页面,发过来的通知
                console.log("onNotification:" + JSON.stringify(res.detail))
                var name = res.detail.name;
                if (name == "reviseCotent") {
                    this.content = res.detail.content;
                } else if (name == "open") {
                    this.open()
                } else if (name == "close") {
                    this.close()
                }
            },
            gingDidBegan(res) { //浮窗开始移动回调
                console.log("gingDidBegan:" + JSON.stringify(res.detail))
            },
            gingDidChanged(res) { //浮窗移动改变
                console.log("gingDidChanged:" + JSON.stringify(res.detail))
            },
            gingDidEnded(res) { //浮窗移动完成回调
                console.log("gingDidEnded:" + JSON.stringify(res.detail))
            },
            open() {
                var dic = {
                    "draggingType": 3 //0(不能拖拽) 1(正常拖拽) 2(释放后还原) 3(自动靠边,只会靠左右两边) 4(靠边时自动吸附边缘,可吸附四周)
                }
                this.$refs.floatWindow.open(dic);
            },
            isOpen() {
                this.$refs.floatWindow.isOpen((res) => {
                    console.log("isOpen:" + JSON.stringify(res))
                });
            },
            close() {
                this.$refs.floatWindow.close()
            },
            bringSubviewToFront() {
                this.$refs.floatWindow.bringSubviewToFront()
            },
            updateLayout() {
                this.$refs.floatWindow.updateLayout({
                    x: 0,
                    y: 100,
                    // width: 200,
                    // height: 300
                })
            },
            closeWindowAllSubView() {
                this.$refs.floatWindow.closeWindowAllSubView()
            },
            xiugai() {
                this.content = "首页修改的值"
            },
            tiaozhuan() {
                uni.navigateTo({
                    url: "index4"
                })
            },
        }
    }
</script>

<style>
    .content {
        width: 750rpx;
    }

    .floatWindow {
        position: fixed;
    }

    .floatWindowContent {
        padding: 10px;
        background-color: yellow;
    }
</style>

隐私、权限声明

1. 本插件需要申请的系统权限列表:

2. 本插件采集的数据、发送的服务器地址、以及数据用途说明:

插件不采集任何数据

3. 本插件是否包含广告,如包含需详细说明广告表达方式、展示频率:

使用中有什么不明白的地方,就向插件作者提问吧~ 我要提问