c***@126.com
c***@126.com
  • 发布:2022-11-24 22:47
  • 更新:2022-11-24 22:47
  • 阅读:56

【报Bug】vue3下button的disabled=true时点击会触发异常

分类:HBuilderX

产品分类: HbuilderX

PC开发环境操作系统: Windows

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

HBuilderX类型: Alpha

HBuilderX版本号: 3.6.8

示例代码:

app.vue

onError(e){  
            console.error(e)  
            try{  
                let txt = e.message  
                uni.showToast({  
                    title: txt,  
                })  
            }catch(e){  
                console.error(e)  
            }  
        },
<template>  
    <view>  
        <button @click="clickNext2" type="default" :disabled="btnDisable1" >vue3 bug</button>  
        <button @click="clickNext2" type="default" :disabled="btnDisable2" >good</button>  
    </view>  
</template>  

<script>  
    export default {  
        data(){  
            return {  
                btnDisable1 : true,  
                btnDisable2 : false,  
            }  
        },  
        methods: {  
            clickNext2(){  
                console.warn('clicked')  
            },  
        },  
    }  
</script>  

操作步骤:
  1. 创建空白项目,manifest.json 中vue改成3版本。
  2. 增加一个button,disable=true,
  3. App.vue 中的onError增加Toast显示错误信息
  4. 浏览器调试,点击button,报 TypeError: e2.stopImmediatePropagation is not a function

预期结果:

正常无错误

实际结果:
22:54:21.612 App Launch at App.vue:4  
22:54:21.615 App Show at App.vue:7  
22:54:23.013 TypeError: e2.stopImmediatePropagation is not a function  
    at http://localhost:5173/@fs/D:/dev-soft/HBuilderX.3.6.10.20221121-alpha/HBuilderX/plugins/uniapp-cli-vite/node_modules/@dcloudio/uni-h5/dist/uni-h5.es.js:2269:19  
    at http://localhost:5173/@fs/D:/dev-soft/HBuilderX.3.6.10.20221121-alpha/HBuilderX/plugins/uniapp-cli-vite/node_modules/@dcloudio/uni-h5-vue/dist/vue.runtime.esm.js:9693:60  
    at callWithErrorHandling (http://localhost:5173/@fs/D:/dev-soft/HBuilderX.3.6.10.20221121-alpha/HBuilderX/plugins/uniapp-cli-vite/node_modules/@dcloudio/uni-h5-vue/dist/vue.runtime.esm.js:1336:22)  
    at callWithAsyncErrorHandling (http://localhost:5173/@fs/D:/dev-soft/HBuilderX.3.6.10.20221121-alpha/HBuilderX/plugins/uniapp-cli-vite/node_modules/@dcloudio/uni-h5-vue/dist/vue.runtime.esm.js:1345:21)  
    at HTMLElement.invoker (http://localhost:5173/@fs/D:/dev-soft/HBuilderX.3.6.10.20221121-alpha/HBuilderX/plugins/uniapp-cli-vite/node_modules/@dcloudio/uni-h5-vue/dist/vue.runtime.esm.js:9672:17)at App.vue:13  
22:54:23.023 clicked at pages/index/index.vue:19  

bug描述:

vue2下正常,仅vue3下会出现。
正式版3.5.3也正常;3.6.x 开始有这个问题

2022-11-24 22:47 负责人:DCloud_UNI_GSQ 分享
已邀请:

要回复问题请先登录注册