SetDirviceData() var $as = $('#J_ActionSheet'), index = 0; var ListData = JSON.parse(localStorage.getItem(list)) function isRender() { if(ListData.length == 0 ) { $('.list-theme4').empty() $('.list-theme4').append(`

没有数据

`) } else { Render(ListData) } } function Render(data) { $(".list-theme4").empty() data.forEach((val,index) => { $(".list-theme4").append(`

${val.title}

${val.imtro.substring(0,20)}
`) }); } isRender() touchStart() function touchStart() { $(".list-theme4 .list-item").on({ touchstart: function(e){ index = $(this).index() timeOutEvent = setTimeout(function(){ $as.actionSheet('open'); },300); } }); } $('#J_Cancel').on('click', function () { $as.actionSheet('close'); }); $('.delete').on('click', function () { ListData.splice(index,1) // Render(ListData) isRender() touchStart() $as.actionSheet('close'); localStorage.setItem(list,JSON.stringify(ListData)) }); $(".list-theme4 .list-item").on('click',function() { var current = ListData[$(this).index()]; localStorage.setItem("info",JSON.stringify(current)) location.href = "./info.html" })