MonikaChen
MonikaChen
  • 发布:2021-01-24 12:06
  • 更新:2021-01-24 15:50
  • 阅读:1122

【报Bug】uni ui的fab按钮无法悬浮在nvue的plus.webvie上面

分类:uni-app

产品分类: uniapp/App

PC开发环境操作系统: Windows

PC开发环境操作系统版本号: Win10

HBuilderX类型: 正式

HBuilderX版本号: 3.0.7

手机系统: Android

手机系统版本号: Android 7.0

手机厂商: 模拟器

手机机型: Mumu模拟器

页面类型: nvue

打包方式: 离线

项目创建方式: HBuilderX

示例代码:
<template>  
    <view>  
        <uni-fab></uni-fab>  
    </view>  
</template>  
<script>  
    import uniFab from '@/components/uni-fab/uni-fab.vue'  
    export default {  
        components: {  
            uniFab  
        },  
        onLoad() {  
            const systemInfo = uni.getSystemInfoSync()  
            // plus.webview.open('https://dcloud.io/', {width: systemInfo.safeArea.width, height: systemInfo.safeArea.height})  
        }  
    }  
</script>

操作步骤:

原帖:https://ask.dcloud.net.cn/question/116081

bug:
@DCloud_heavensoft

代码如下:

<template>  
    <view>  
        <uni-fab></uni-fab>  
    </view>  
</template>  
<script>  
    import uniFab from '@/components/uni-fab/uni-fab.vue'  
    export default {  
        components: {  
            uniFab  
        },  
        onLoad() {  
            const systemInfo = uni.getSystemInfoSync()  
            // plus.webview.open('https://dcloud.io/', {width: systemInfo.safeArea.width, height: systemInfo.safeArea.height})  
        }  
    }  
</script>

注销掉plus.webview.open时可以看到fab按钮
imgbed.cn图床

如果显示webview,则fab按钮被覆盖
imgbed.cn图床

预期结果:

fab覆盖在webview上

实际结果:

webview覆盖在fab上

bug描述:

原帖:https://ask.dcloud.net.cn/question/116081

bug:
@DCloud_heavensoft

代码如下:

<template>  
    <view>  
        <uni-fab></uni-fab>  
    </view>  
</template>  
<script>  
    import uniFab from '@/components/uni-fab/uni-fab.vue'  
    export default {  
        components: {  
            uniFab  
        },  
        onLoad() {  
            const systemInfo = uni.getSystemInfoSync()  
            // plus.webview.open('https://dcloud.io/', {width: systemInfo.safeArea.width, height: systemInfo.safeArea.height})  
        }  
    }  
</script>

注销掉plus.webview.open时可以看到fab按钮
imgbed.cn图床

如果显示webview,则fab按钮被覆盖
imgbed.cn图床

2021-01-24 12:06 负责人:无 分享
已邀请:
DCloud_heavensoft

DCloud_heavensoft

不是bug。fab是前端组件,可以覆盖在同为组件的web-view上。
但用plus.webview方式创建的webview是另一个view,前端的fab肯定盖不住。

  • MonikaChen (作者)

    那要如何才能覆盖?

    2021-01-24 18:09

  • MonikaChen (作者)

    如何做个按钮去覆盖plus.webview并且有点击事件?

    2021-01-24 18:10

  • MonikaChen (作者)

    subNVUE能覆盖得了吗?

    2021-01-24 19:21

  • DCloud_heavensoft

    回复 MonikaChen: 可以

    2021-01-24 20:25

  • MonikaChen (作者)

    回复 DCloud_heavensoft: 多谢指点,我试试

    2021-01-24 22:29

  • MonikaChen (作者)

    回复 DCloud_heavensoft: 试了一下subNVue,还是会被plus.webview覆盖掉

    2021-01-24 23:55

  • MonikaChen (作者)

    回复 DCloud_heavensoft: 尝试用zindex解决,发现也是个bug,几年前有人提出过:https://ask.dcloud.net.cn/question/22817

    2021-01-25 00:16

  • MonikaChen (作者)

    回复 DCloud_heavensoft: 因为要拦截webview资源的加载,查了一下资料,貌似只有plus.webview能做到,<web-view>标签没给这个权限。同时需要右下角悬浮一个按钮作为功能键。如果实在不行,那交互就的更改成不用悬浮的,操作便捷度会差一些。我一度绝望到打算学安卓原生开发,哎

    2021-01-25 11:58

  • DCloud_UNI_GSQ

    回复 MonikaChen: 熟悉了原生开发的确可以让你有更多的方法解决 uni-app 中的需求,不过即使你不熟悉原生开发也可以通过熟悉 5+API 来解决很多需求。比如使用 plus.nativeObj.View 来覆盖:先创建 webview,再创建 nativeView,然后 append 到 webview 上。

    2021-01-25 17:03

  • MonikaChen (作者)

    回复 DCloud_UNI_GSQ: plus.nativeObj.View是可以,无法用uniapp的组件,做界面会麻烦很多

    2021-01-25 23:00

该问题目前已经被锁定, 无法添加新回复