anchor.79b84e7c.js 1.1 KB

1
  1. import{_ as x,d as g,w as k,c7 as y,x as b,o as l,c as u,F as C,D as B,B as T,L as D}from"./index.42bf163d.js";const E={fixed:"","p-5":"","text-sm":"","font-bold":""},w=["onClick"],N=g({__name:"anchor",props:{map:{type:Map,required:!0}},setup(i){const r=i,n=k(null),{y:o}=y(n);b(()=>{n.value=document.getElementsByClassName("el-scrollbar__wrap")[1]});function d(s){const{top:e}=r.map.get(s);n.value.scrollTo({top:Number(e)})}function m(s){let e=0,t=0;const a=[...r.map.entries()],{top:v,index:c}=r.map.get(s);return a.forEach(([A,{index:p,top:_}])=>{const f=c+1===p,h=c-1===p;f&&(e=_),h&&(t=_)}),c===0?o.value>=0&&o.value<e:o.value>t&&o.value<e&&o.value>=v}return(s,e)=>(l(),u("ul",E,[(l(!0),u(C,null,B(i.map.entries(),([t],a)=>(l(),u("li",{class:T(["hover:text-blue hover:bg-#f7f7f7 cursor-pointer duration-200ms p-1.5 m-1 rounded",{"is-active":m(t)}]),onClick:()=>d(t),key:a},D(t),11,w))),128))]))}});var I=x(N,[["__scopeId","data-v-5d3b9dd1"],["__file","C:/Users/63107/Desktop/projects/accout-vue3-ui/src/views/search/standBook/components/anchor.vue"]]);export{I as default};