API
Component

Contents ($UI/system/components/justep/contents/contents)

使用范围:UI2

Contents

component Contents ($UI/system/components/justep/contents/contents) extends ViewComponent

<b>使用场景</b>:可实现左右滑动打开不同内容页的效果(常与导航栏或按钮组搭配实现页面切换效果; <b>使用方法</b>:内容页支持自定义设计,也支持通过内嵌组件内嵌其他页面; ## <b>文档链接</b>:#http://docs.newdao.net/app/zuo-you-hua-kuai.html#

	
	

Constructor Top

  Contents ()
  Contents ( options)

Properties Top

Boolean EOF

是否已经到最后

boolean slidable

是否采用滑动动画

boolean swipe

是否支持手势,如果想同时支持内部横向滚动内容还能滚动需要在滚动区域加class(x-scroll-h)

boolean wrap

是否可循环切换

Attributes Top

integer active

当前content的索引

boolean routable

是否开启路由

boolean slidable

是否采用滑动动画

boolean swipe

是否支持手势,如果想同时支持内部横向滚动内容还能滚动需要在滚动区域加class(x-scroll-h)

boolean wrap

是否可循环切换

string xid

Methods Top

Content add (object content配置)
get (String name)
getActiveIndex ()
String getActiveXid ()
Content getContent (String xid)
getIndexByXid (string xid)
Integer getLength ()
boolean hasNext ()
void next (Function chengedCallback)
void prev (Function chengedCallback)
void remove (integer index, integer to)
void set (json arg)
void slide (string transDir, integer transIdx, function fn)
void to (String 目标页xid, Function chengedCallback)

Operations Top

next ()
prev ()
to (String 目标页xid)

Events Top

void onActiveChange (ContentsActiveEvent event)

Constructor details Top

public Contents ()

<b>使用场景</b>:可实现左右滑动打开不同内容页的效果(常与导航栏或按钮组搭配实现页面切换效果; <b>使用方法</b>:内容页支持自定义设计,也支持通过内嵌组件内嵌其他页面; ## <b>文档链接</b>:#http://docs.newdao.net/app/zuo-you-hua-kuai.html#

	
	

public Contents ( options)

构造函数

Inherited from ViewComponent

	
		参数options格式类似{parent:xx, config:{}},parent是组件的父节点,允许为空或不指定,config是组件的参数选项
	 

Parameters

options

参数选项

Properties Detail Top

public Boolean EOF

是否已经到最后

public boolean slidable

是否采用滑动动画

public boolean swipe

是否支持手势,如果想同时支持内部横向滚动内容还能滚动需要在滚动区域加class(x-scroll-h)

public boolean wrap

是否可循环切换

Attributes Detail Top

public integer active

当前content的索引

public boolean routable

是否开启路由

public boolean slidable

是否采用滑动动画

public boolean swipe

是否支持手势,如果想同时支持内部横向滚动内容还能滚动需要在滚动区域加class(x-scroll-h)

public boolean wrap

是否可循环切换

public string xid

Methods Detail Top

public Content add (object content配置)

添加一个content

Parameters

object content配置

Return Value

Content

public get (String name)

获取contents的属性

Parameters

String name

属性名称,取值范围:"slidable", "wrap", "swipe"

Return Value

返回属性值

public getActiveIndex ()

获取当前active索引

Return Value

integer

public String getActiveXid ()

获取当前激活content的xid

Return Value

String

public Content getContent (String xid)

通过xid获取content

Parameters

String xid

Return Value

Content

public getIndexByXid (string xid)

通过content的xid获取索引

Parameters

string xid

content的xid

Return Value

integer

public Integer getLength ()

获得content个数

Return Value

Integer

public boolean hasNext ()

是否有下一个

Return Value

boolean

public void next (Function chengedCallback)

切换下一页

Parameters

Function chengedCallback

100 切换完成后 (Optional)

Return Value

void

public void prev (Function chengedCallback)

切换到前一个content

Parameters

Function chengedCallback

100 切换完成后 (Optional)

Return Value

void

public void remove (integer index, integer to)

删除一个content

Parameters

integer index

删除的content索引

integer to

删除后切换到的content索引, 可选

Return Value

void

public void set (json arg)

设置contents的属性

Parameters

json arg

属性值对
结构如下:

{ "slidable" : {boolean} 是否采用滑动动画 "wrap" : {boolean} 是否可循环切换 "swipe" : {boolean} 是否支持手势 }

Return Value

void

public void slide (string transDir, integer transIdx, function fn)

切换到指定content, 同时可以指定切换的方向

Parameters

string transDir

切换的方向, 'prev'或'next'

integer transIdx

目标的索引

function fn

切换完成执行的方法, 可选

Return Value

void

public void to (String 目标页xid, Function chengedCallback)

切换到指定的content

Parameters

String 目标页xid
Function chengedCallback

切换完成后 (Optional)

Return Value

void

Operations Detail Top

public next ()

切换下一页

public prev ()

切换到前一个content

public to (String 目标页xid)

切换到指定的content

Parameters

String 目标页xid

Events Detail Top

public void onActiveChange (ContentsActiveEvent event)

[回调型事件]当active改变时触发

Parameters

ContentsActiveEvent event


结构如下:

{ "source" : 组件的js对象, "to": 新的active值, "from": 原来的active值, "type": "prev"是向前, "next"是向后 }

Return Value

void