Files
sbnews/server/public/mobile/assets/pages-collection-collection.C0W7Eoi-.js
T

2 lines
1.2 KiB
JavaScript

import{d as e,a2 as a,J as s,r as l,x as t,l as o,w as n,F as i,P as u,o as c,y as r,c as d}from"./index-uBvBZpJK.js";import{i as p,f as m}from"./news.C0-POuEl.js";const w=e({__name:"collection",setup(e){const w=a(),g=s([{text:"取消收藏",style:{color:"#FFFFFF",backgroundColor:"#FF2C3C"}}]),y=l([]),f=async(e,a)=>{const{lists:s}=await p();s.forEach(e=>{e.show=!1}),y.value=s,w.value.complete(s)},h=async e=>{try{const a=y.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 c(),t(i,null,[o(s,{"page-style":e.$theme.pageStyle},null,8,["page-style"]),o(m,{ref_key:"paging",ref:w,modelValue:y.value,"onUpdate:modelValue":a[0]||(a[0]=e=>y.value=e),onQuery:f,fixed:!1,height:"100%","use-page-scroll":""},{default:n(()=>[(c(!0),t(i,null,r(y.value,(e,a)=>(c(),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};