anchor.0a7e39.js 1.1 KB

1
  1. import{_ as x,d as b,w as g,bH as k,x as y,o as l,c as u,F as C,D as B,B as T,L as D}from"./index.js";const E={fixed:"","p-5":"","text-sm":"","font-bold":""},w=["onClick"],A=b({__name:"anchor",props:{map:{type:Map,required:!0}},setup(i){const r=i,n=g(null),{y:o}=k(n);y(()=>{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(([N,{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(A,[["__scopeId","data-v-5d3b9dd1"],["__file","C:/Users/Administrator/Desktop/projects/purchase-vue3/src/views/search/standBook/components/anchor.vue"]]);export{I as default};