Usage
- HeroNode FE API
- Script for the project
- How to use it in a project
Introduce: Hero was a framework to develop crossplatform app. Now it is a framework to develop Dapp
First you need to get hero.js into your project. This can be done using the following methods:
-
git clone https://github.com/hero-node/hero-js.git
-
cd hero-js
-
npm install
Then you need to run the projects:
npm start
After that you can open the service at http://127.0.0.1:3000/projects/
text
- The alert text
title
- The button title
disabled
- The button isDisabled
backgroundDisabledColor
- The button backgroundDisabledColor
titleColor
- The button titleColor
backgroundColor
- The button backgroundColor
size
- The button fontSize
cornerRadius
- The button borderRadius
image
- The button image
text
- The chat-msg-view text
text
- The confirm text
open()
- The confirm window opened
close()
- The confirm window closed
tapOk()
- User clicked confirm(ok)
tapCancel()
- User clicked cancel
show
- The contact-view isShow(only mobile)
text
- The dialog text
open()
- The dialog window opened
close()
- The dialog window closed
json
- The image-view imageFile(path/base64)
text
- The label text
size
- The label fontSize
alignment
- The label textAlign
textColor
- The label textColor
weight
- The label fontWeight
true
- show
false
-hide
fetch_coordinate
- The location-view fetch_coordinate
type
- The ocr-view type
value
- The switch isChecked
click
- The switch click
height
- The cell height
textValue
- The cell textValue
detail
- The cell detail
title
- The cell title
bottomLine
- The cell bottomLine
size
- The cell size
color
- The cell color
image
- The cell image
accessoryType
- The cell rightButton
indentationWidth
- The cell titleXoffset
sectionTitle
- The cell sectionTitle
rows
- The cell style
textChange
- The textView change event
size
- The text-filed size
textColor
- The text-filed textColor
clear
- Clear the text-filed
text
- The text-filed text
placeHolder
- The text-filed placeHolder
secure
- The text-filed secure
type
- The text-filed type
focus
- The text-filed focus
blur
- The text-filed blur
textChange
- The text change event
position
- The toast position
text
- The toast text
title
- The toolbar title
image
- The toolbar image
This script is used to compile solidity.
a.install -- web3 solc fs path
b.compile -- node compiler.js
a. Find in the project if a file in the '.sol' format exists.
b. If so, run this script
c. Generate the corresponding '.abi', '.js', '.json' files
This script is used to deploy solidity.
a.install -- web3 fs path ethereumjs-tx
b.deploy -- node deploy.js
a. Find in the project if a file in the '.abi', '.json' format exists.
b. Sign with the private key
c. Deploy the contract by sending a transaction
d. Through the web3.eth.getTransactionReceipt() to return the contract deployment of address
d. Generates a contract address file and writes the contract address
Publish the project to geth and ipfs nodes.
a.install -- shelljs/global http-proxy-middleware
b.publish -- node go.js
a. Whether to open ipfs nodes.
b. If not, run 'ipfs daemon'.
c. Whether to open Geth.
d. If not, run 'geth'.
d. Forward ports to '8080' and '8545'
Hero.ui = {
version: -1,
tintColor: 'bd3a53', //The font color
// The navigation items' UI and Style
nav: {
title: "区块链-集五福", // nav title (string)
titleColor: 'ffffff', // title color(omit '#')
navigationBarHidden: false,// Whether the nav bar is displayed(bool)
leftItems: [{title:'back'},{image:'fu'}]// Upper left item button (eg. Return to previous page)
},
// Hero UI item
views: [
eg. A button to submit the form
{
class:'HeroButton', // Use the Corresponding Hero Component
ripple: true, // Whether the effects of clicks is displayed(bool)
title:'查看奖池',// button content (string)
titleColor:'999999',// button content text color
size:12, // fontSize
// postion: {'w': width, 'h': height, 'l': left, 'r': right, 'b': bottom, 'y': top;} 'x': 100%('0.5x': 50%)
frame:{r:'10',w:'80',y:'0.5x+32',h:'30'},
// event: This can be handled here or Hero.on = function (data){if (data.click === 'submit'){
//}}
// click: {click: 'submit'}
click:{command:'goto:'+path+'dalao.html'}
}
]
}
Hero.on() = function (data) {
<!-- eg. -->
if (data.click === 'submit') {
<!-- The event -->
}
}
Hero.viewWillAppear() = function () {
<!-- The 'viewWillAppear' event -->
}
Hero.viewWillDisAppear() = function () {
<!-- The 'viewWillDisAppear' event -->
}
Hero.viewDidload() = function () {
<!-- The 'viewDidload' event -->
}