mui.init({
swipeBack:
false,
pullRefresh:
{
container:
'#pullrefresh',
down:
{
callback:
pulldownRefresh
}
}
})
/**
* 下拉刷新具体业务实现 */
var
last=-5,amount=5
function
pulldownRefresh()
{
last =last+amount
var
table =
document.body.querySelector('.mui-table-view')
var
cells =
document.body.querySelectorAll('.mui-table-view-cell')
mui.ajax({
type:
"post",
dataType:
"json",
url:
"http://localhost/amazeui/data.php?action=item",
data:
"last="+last+"&amount="+amount,
complete :function(){$("#load").hide()},
success:
function(msg){
var
data =
msg
var
tmp=''
$.each(data,
function(i,
n){
var
li =
document.createElement('li')
li.className
=
'mui-table-view-cell'
li.innerHTML
=
'<a class="mui-navigate-right">'
+
n.itemname
+
'</a>'
//下拉刷新,新纪录插到最前面;
table.insertBefore(li,
table.firstChild)
})
}
})
mui('#pullrefresh').pullRefresh().endPulldownToRefresh()
//refresh completed
}
if
(mui.os.plus)
{
mui.plusReady(function()
{
setTimeout(function()
{
mui('#pullrefresh').pullRefresh().pullupLoading()
},
1000)
})
}
else
{
mui.ready(function()
{
mui('#pullrefresh').pullRefresh().pullupLoading()
})
}
</script>
两种方案:1、直接获取当前选中项的节点
var elem = document.querySelector('.mui-table-view-radio .mui-selected')
console.log(elem.innerText)
2、监听列表式单选框的选择事件,如下:
document.querySelector('.mui-table-view.mui-table-view-radio').addEventListener('selected',function(e){
console.log("当前选中的文本值为:"+e.detail.el.innerText)
})
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)