One app to get started (vii)-Completing the Discovery page

Source: Internet
Author: User

The seventh chapter is the penultimate article of the introductory article, and tomorrow the whole app will go to the finale.

This tutorial mainly teaches you to use QR code to scan and add the Do_webview component to the HTML page.

    • Import Project
    • Do_webview components
    • Scan function
    • Custom events

The demo that will be learned is shown below

1. Import the full project

This section of the sample demo is referenced and can be imported into the designer for learning.

The components to be used in this tutorial are Do_barcodeview the methods taught in the previous tutorials, add these two components ahead of time, and make the appropriate debug package for debugging.

2. Do_webview Components
Do_webview is a powerful component that can access both Web pages and local HTML, as well as nesting deviceone components in HTML pages that perfectly combine H5 pages and deviceone native components.

Analysis of the discovery page we are going to implement, click on the "Scan" button to call Do_barcodeview scan function, QR Code scan, and put a Do_webview component in the center of the page, load the local HTML file, in the file to customize the page style, and the button buttons in the HTML are drawn in response to the Deviceone functions of each component.

For more detailed documentation please see the use of WebView

3. Scanning function
Create a new Scanbarcode.ui page, put a do_barcodeview component in it, click on the "Click to Scan" button to open the page, and call Do_barcodeview scan function scanning QR code, Call Closepage in the successful callback to close the page, here for demonstration purposes only, the results of the normal scan will be returned in the callback function data, the user can get this data to do any action.

4. Custom Events
DeviceOneProvides an event and message mechanism that developers can use very conveniently. Here's a simple example:

By using on to subscribe to the do_alayout_opt Touch event, fire is used to trigger the event in the right place, and it is important to note that the triggering of the event is required after the subscription.

For more detailed documentation see the event and message mechanism introduction

One app to get started (vii)-Completing the Discovery page

Related Article

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.