- 发布:2023-06-15 16:27
- 更新:2024-04-23 18:14
- 阅读:442
产品分类: 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>
预期结果:
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
2 个回复
3***@qq.com
我也遇到同样的问题,您解决了吗
2***@qq.com - 大侠
兄弟解决了吗