HTML5 development practices-Sencha Touch (2)

Source: Internet
Author: User

HTML5 development practices-Sencha Touch (2)

Generally, the basic layout of a page is the same for an APP. Below are several tabs used for selection to achieve page switching. Click different buttons to switch to different content. Sencha Touch can easily perform such operations.

First, we need to make sure that we want to use TabPanel here. As the name suggests, this component adds a tab at the bottom of the interface and can switch between pages through the tab. The basic code is as follows:

 

Launch: function () {Ext. viewport. add ({Xtype: 'tabpanel ', // select tabpanel as the main panel tabBarPosition: 'bottom', // This attribute sets the tab position items: [// define the page topic content {title: 'home', iconCls: 'home', cls: 'home', html: [// enter the html page topic code here]. join ("")}, //…]});}

Let's take a look at the features of this component in Sencha Touch. After defining this component, you can use tabBarPosition to set the position of the tab. Usually at the bottom. Next, we can use items to define the content contained in TabPanel. Each definition of an items not only defines the content of the tab button, but also the content of the corresponding page.

The code above is used as an example. Now we define a tab with the title of Home and set the icon for it. The content in the html attribute is written in the tab page. You can directly use the normal html code or the CSS style. It is bound with the corresponding button of the tab. In this way, we can define multiple tabs, which forms the basic framework of the entire app.

In normal development, to make the development process clearer and simpler, we can write them on one interface and add them to one interface to achieve the desired effect.

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.