Analysis of simple calculator to get you started with WeChat applet development

Source: Internet
Author: User
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

  1. 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.

  2. 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.

  3. JS in small programs is not really JavaScript, and wxss is not really CSS, so pay attention to it when writing.

  4. 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!

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.