header.cd67b95e.js 3.0 KB

1
  1. import{d as y,V as i,aq as k,$ as j,as as w,U as S,ao as x,h as C,a as s,S as T,G as R,H as p,z as O,x as V,u as K,R as M,P as I}from"./vendor.405ecf9c.js";/* empty css *//* empty css *//* empty css *//* empty css */import{C as U}from"./index.96f38933.js";import{c as N}from"./index.126c459c.js";import{c as z}from"./index.926ca9c5.js";import{S as B}from"./select-tag.b4a39592.js";import{g as H}from"./music.dc47b4d7.js";function P(t){return{all:t=t||new Map,on:function(n,a){var o=t.get(n);o?o.push(a):t.set(n,[a])},off:function(n,a){var o=t.get(n);o&&(a?o.splice(o.indexOf(a)>>>0,1):t.set(n,[]))},emit:function(n,a){var o=t.get(n);o&&o.slice().map(function(r){r(a)}),(o=t.get("*"))&&o.slice().map(function(r){r(n,a)})}}}const $="_search_ngdof_1",q="_sticky_ngdof_9",A="_title_ngdof_15",D="_keywords_ngdof_21",F="_content_ngdof_28",G="_searchKeyword_ngdof_38",L="_remove_ngdof_46",W="_label_ngdof_49";var u={search:$,sticky:q,title:A,keywords:D,content:F,searchKeyword:G,remove:L,label:W};function E(t){return typeof t=="function"||Object.prototype.toString.call(t)==="[object Object]"&&!V(t)}const m=P(),b=i();var J=y({name:"MusicSearchHeader",setup(){const t=i();localStorage.setItem("behaviorId",H());const n=k(),a=j(),o=i(""),r=i(""),f=i(!1),c=N("music-search",[]),d=i("songe");w(()=>{var e,l;if(a.path==="/music-songbook/search"){o.value="",r.value="",g.name="\u5168\u90E8",g.id="",d.value="songe";try{(l=(e=b.value)==null?void 0:e.resetTags)==null||l.call(e)}catch(h){console.log(h)}}return!0}),S(d,e=>{m.emit("changeTab",e)});const v=e=>{o.value=e;const l=c.value.indexOf(e);l>-1&&c.value.splice(l,1),e&&(c.value.unshift(e),c.value.length=Math.min(c.value.length,5)),m.emit("search",e)},_=(e,l="")=>{const h=Object.values(e).flat().filter(Boolean).join(",");r.value=h,m.emit("confirm",e),f.value=!1};x(()=>{});const g=C({show:!1,name:"\u5168\u90E8",id:""});return()=>s("div",{class:u.search},[s(T,{class:u.sticky},{default:()=>[s(U,{modelValue:o.value,showAction:!0,ref:t,onSearch:v,onFilter:()=>f.value=!0,filterDot:!!r.value,onClick:()=>{a.path==="/music-songbook"&&n.push({path:"/music-songbook/search"})}},null),a.path==="/music-songbook/search"&&s(R,{color:"var(--van-primary)",background:"transparent",lineWidth:20,shrink:!0,active:d.value,"onUpdate:active":e=>d.value=e,onChange:e=>d.value=e},{default:()=>[s(p,{title:"\u5355\u66F2",name:"songe"},null),s(p,{title:"\u4E13\u8F91",name:"album"},null)]})]}),c.value.length>0&&a.path==="/music-songbook/search"&&s("div",{class:z(u.keywords,"van-hairline--bottom")},[s("div",{class:u.content},[c.value.map(e=>s(O,{round:!0,class:u.searchKeyword,key:e,onClick:()=>v(e)},E(e)?e:{default:()=>[e]}))]),s(K,{class:u.remove,name:"delete-o",onClick:()=>c.value=[]},null)]),s(M,null,null),s(I,{show:f.value,round:!0,closeable:!0,position:"bottom",style:{height:"60%"},teleport:"body","onUpdate:show":e=>f.value=e},{default:()=>[s(B,{ref:b,onConfirm:_,onCancel:()=>{}},null)]})])}}),ce=Object.freeze({__proto__:null,[Symbol.toStringTag]:"Module",mitter:m,default:J});export{ce as h,m,u as s};