1***@qq.com
1***@qq.com
  • 发布:2023-06-15 16:27
  • 更新:2024-04-23 18:14
  • 阅读:298

【报Bug】最新版还不能支持bip39 等这些区块链开发的常用加密库么?

分类:uni-app

产品分类: uniapp/App

PC开发环境操作系统: Mac

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

HBuilderX类型: 正式

HBuilderX版本号: 3.8.4

手机系统: 全部

手机厂商: 华为

页面类型: vue

vue版本: vue2

打包方式: 云端

项目创建方式: HBuilderX

测试过的手机:

安卓和苹果还有模拟机

示例代码:
npm install bip39

安装bip39

index.vue 里面代码是

<template>  
    <view>  
        <button @click="getzjc()">zjc</button>  
        <text>{{zjc}}</text>  
    </view>  
</template>  

<script>  
    import * as bip39 from 'bip39'  
    export default {  
        data() {  
            return {  
                zjc: ''  
            }  
        },  
        methods: {  
            getzjc(){  
                this.zjc = bip39.generateMnemonic()  
            }  
        }  
    }  
</script>  

<style>  

</style>  

操作步骤:
npm install bip39

安装bip39

index.vue 里面代码是

<template>  
    <view>  
        <button @click="getzjc()">zjc</button>  
        <text>{{zjc}}</text>  
    </view>  
</template>  

<script>  
    import * as bip39 from 'bip39'  
    export default {  
        data() {  
            return {  
                zjc: ''  
            }  
        },  
        methods: {  
            getzjc(){  
                this.zjc = bip39.generateMnemonic()  
            }  
        }  
    }  
</script>  

<style>  

</style>  

预期结果:
npm install bip39

安装bip39

index.vue 里面代码是

<template>  
    <view>  
        <button @click="getzjc()">zjc</button>  
        <text>{{zjc}}</text>  
    </view>  
</template>  

<script>  
    import * as bip39 from 'bip39'  
    export default {  
        data() {  
            return {  
                zjc: ''  
            }  
        },  
        methods: {  
            getzjc(){  
                this.zjc = bip39.generateMnemonic()  
            }  
        }  
    }  
</script>  

<style>  

</style>  

实际结果:
npm install bip39

安装bip39

index.vue 里面代码是

<template>  
    <view>  
        <button @click="getzjc()">zjc</button>  
        <text>{{zjc}}</text>  
    </view>  
</template>  

<script>  
    import * as bip39 from 'bip39'  
    export default {  
        data() {  
            return {  
                zjc: ''  
            }  
        },  
        methods: {  
            getzjc(){  
                this.zjc = bip39.generateMnemonic()  
            }  
        }  
    }  
</script>  

<style>  

</style>  

bug描述:

npm install bip39

安装bip39

index.vue 里面代码是

<template>  
    <view>  
        <button @click="getzjc()">zjc</button>  
        <text>{{zjc}}</text>  
    </view>  
</template>  

<script>  
    import * as bip39 from 'bip39'  
    export default {  
        data() {  
            return {  
                zjc: ''  
            }  
        },  
        methods: {  
            getzjc(){  
                this.zjc = bip39.generateMnemonic()  
            }  
        }  
    }  
</script>  

<style>  

</style>  

在chrome运行 h5 可以生成助记词,但是在手机模拟器和真机上调试报错,错误信息如下:

[Vue warn]: Error in v-on handler: "Error: crypto.getRandomValues must be defined"

(found at pages/index/index.vue:1)
16:18:20.673 Error: crypto.getRandomValues must be defined

2023-06-15 16:27 负责人:YUANRJ 分享
已邀请:
3***@qq.com

3***@qq.com

我也遇到同样的问题,您解决了吗

2***@qq.com

2***@qq.com - 大侠

兄弟解决了吗

要回复问题请先登录注册