使用TabBar
TabBar可以包括多个页面,可以在顶端或底端显示页面切换按钮:
一个例子
上图的效果是通过下面的HttpRequest事件代码生成的,因为包括三个页面的内容,所以代码比较长:
Select
Case e.Path
Case "test.htm"
Dim
wb As New
WeUI
Dim
txt As
String = "由各种物质组成的巨型球状天体,叫做星球.星球有一定的形状,有自己的运行轨道."
'增加三个页面,一个按钮
With
wb.AddTabBar("",
"tb1", 1)
.AddPage("page1","微信","./images/button.png")
.AddPage("page2","通讯录","./images/msg.png")
.AddPage("page3","发现","./images/article.png")
.AddButton("bt1","我","./images/cell.png","http://www.foxtable.com")
End
With
'为第一个页面增加内容
wb.AddForm("page1","form1","test.htm")
With wb.AddInputGroup("form1","ipg1")
.AddInput("xm","户名","text")
.AddInput("mm","密码","password")
End With
With
wb.AddButtonGroup("form1","btg1",True)
.Add("btn1",
"确定", "submit")
End With
'为第二个页面增加内容
With
wb.AddPanelGroup("page2","pg1","图文组合列表")
.Add("pn1","标题一",txt,"./images/button.png","http://www.foxtable.com")
With .Add("pn2","标题二",txt,"./images/search.png")
.AddFoot("文字来源")
.AddFoot("时间")
.AddFoot("|其他信息","http://www.foxtable.com")
End
With
.GroupFoot =
"查看更多"
.GroupHref =
"http://www.foxtable.com/"
End
With
'为第三个页面增加内容
With wb.AddArticle("page3","ar1")
.AddTitle("h1","发现")
.AddTitle("h2","章标题")
.AddTitle("h3","1.1节标题")
.AddContent(txt)
.AddImage("./images/001.jpg")
.AddTitle("h3","1.2节标题")
.AddContent(txt)
.AddImage("./images/002.jpg")
End With
e.WriteString(wb.Build)
End
Select
AddTabBar
AddTabBar用于增加TabBar,语法:
AddTabBar(ParentID, ID, Positon)
ParentID | 父容器的ID,如果是顶层对象,设置为""即可。 |
ID | TabBar的ID |
Position | 按钮位置,0显示在底端,1显示在顶端。 |
AddPage
AddPage用于增加页面,语法:
AddPage(ID, Text)
AddPage(ID, Text, Image)
ID | 页面ID |
Text | 页面按钮标题 |
Image | 可选参数,页面按钮图片 |
AddButton
AddButton用于添加按钮,语法:
AddButton(ID, Text)
AddButton(ID, Text, Image)
AddButton(ID, Text, Image, Href)
ID | 按钮ID |
Text | 按钮标题 |
Image | 可选参数,设置按钮图片 |
Href | 可选参数,字符型,指定单击按钮之后跳转的目标网页的URL |