2 lines
1.2 KiB
JavaScript
2 lines
1.2 KiB
JavaScript
import{d as e,X as a,K as s,r as l,y as t,m as o,w as n,F as i,P as u,l as r,z as c,f as d}from"./index-CtL4_Q40.js";import{i as p,f as m}from"./news.Bp1GPCuq.js";const w=e({__name:"collection",setup(e){const w=a(),g=s([{text:"取消收藏",style:{color:"#FFFFFF",backgroundColor:"#FF2C3C"}}]),f=l([]),y=async(e,a)=>{const{lists:s}=await p();s.forEach(e=>{e.show=!1}),f.value=s,w.value.complete(s)},h=async e=>{try{const a=f.value[e].article_id;await m({id:a}),uni.$u.toast("已取消收藏"),w.value.reload()}catch(a){console.log("取消收藏报错=>",a)}};return(e,a)=>{const s=u("page-meta"),l=u("news-card"),p=u("u-swipe-action"),m=u("z-paging");return r(),t(i,null,[o(s,{"page-style":e.$theme.pageStyle},null,8,["page-style"]),o(m,{ref_key:"paging",ref:w,modelValue:f.value,"onUpdate:modelValue":a[0]||(a[0]=e=>f.value=e),onQuery:y,fixed:!1,height:"100%","use-page-scroll":""},{default:n(()=>[(r(!0),t(i,null,c(f.value,(e,a)=>(r(),d(p,{show:e.show,index:a,key:e.id,onClick:h,options:g,"btn-width":"120"},{default:n(()=>[o(l,{item:e,newsId:e.article_id},null,8,["item","newsId"])]),_:2},1032,["show","index","options"]))),128))]),_:1},8,["modelValue"])],64)}}});export{w as default};
|