Simple analysis calculator takes you to get started with the development of small programs, but the focus is on the back
This is a tutorial, not a tutorial.
Can look at the Demo of the operation of the animation, look at what is a thing, GitHub address (https://github.com/dunizb/wxapp-sCalc)
Wxss:
.btnGroup { display: flex; flex-direction: row; flex:1; width:100%; background-color:#fff;}.item { width:25%; display: flex; align-items: center; flex-direction: column; justify-content: center; margin-top:1px; margin-right:1px;}.item:active { background-color:#ff0000;}
Css has nothing to say. The only thing to note is that it provides a size unit rpx, responsive pixel, which can be adaptive according to the screen width. the official website documents have detailed analysis. I also use the calculator's history page:
Notes
To create a page, remember to add it to the pages attribute of app. josn. Otherwise, the onLoad method of the new page will not be executed after you use navigateTo to jump to the new page.
There are no JavaScript objects such as windows in the applet, so you should think about an alternative solution before writing JavaScript. for example, this calculator is pitted, and the eval function can be used to calculate expressions conveniently, the results cannot be used, and it turns around a lot.
JS in small programs is not really JavaScript, and wxss is not really CSS, so pay attention to it when writing.
This calculator is imperfect and has bugs, because the focus is not to implement all functions, but to clarify the development methods of small programs, so you don't need to worry about it.
For more analysis and easy calculator articles about small program development, please follow the PHP Chinese network!