yarn install
#install browserify:
yarn install browserify -g
#bundle js:(output is bundle.js)
yarn run uniapp_build
yarn run jsonrpc_dev
#default is using dev env, port will be 5080, please modify config/*.json
#or you can use arguments --port xxxx
yarn test
<template>
<view>
<web-view src="/hybrid/html/index.html" @message="handleMessage"></web-view>
</view>
</template>
<script>
export default {
data() {
return {
title: "Wallet",
};
},
methods: {
handleMessage(evt) {
let msg = evt.detail.data[0];
switch (msg.action) {
case "keyringReady":
// here we try to create new account
let currentWebview = this.$scope.$getAppWebview();
let wv = currentWebview.children()[0];
wv.evalJS('createAccount("test", "123456");');
break;
case "createAccountResult":
console.log("create account result:", msg.data);
break;
default:
console.log("unknow msg");
break;
}
},
},
};
</script>