anchor.629836d7.js 1.0 KB

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