1 |
- import{d as _,V as r,ao as y,_ as k,aq as x,U as j,am as w,a as s,S,G as C,H as p,z as T,x as R,u as O,R as V,P as K}from"./vendor.7fdfd452.js";/* empty css *//* empty css *//* empty css *//* empty css */import{C as M}from"./index.17e611e1.js";import{c as I}from"./index.b20f766b.js";import{c as U}from"./index.926ca9c5.js";import{S as N}from"./select-tag.a780d5ec.js";import{g as z}from"./music.41d5135a.js";function B(o){return{all:o=o||new Map,on:function(n,a){var t=o.get(n);t?t.push(a):o.set(n,[a])},off:function(n,a){var t=o.get(n);t&&(a?t.splice(t.indexOf(a)>>>0,1):o.set(n,[]))},emit:function(n,a){var t=o.get(n);t&&t.slice().map(function(l){l(a)}),(t=o.get("*"))&&t.slice().map(function(l){l(n,a)})}}}const H="_search_x5fbt_1",P="_sticky_x5fbt_9",q="_title_x5fbt_15",A="_keywords_x5fbt_21",D="_content_x5fbt_28",F="_searchKeyword_x5fbt_38",G="_remove_x5fbt_46";var u={search:H,sticky:P,title:q,keywords:A,content:D,searchKeyword:F,remove:G};function L(o){return typeof o=="function"||Object.prototype.toString.call(o)==="[object Object]"&&!R(o)}const m=B(),g=r();var W=_({name:"MusicSearchHeader",setup(){const o=r();localStorage.setItem("behaviorId",z());const n=y(),a=k();r(!1);const t=r(""),l=r("");r([]),r([]);const f=r(!1),c=I("music-search",[]),d=r("songe");x(()=>{var e,i;if(a.path==="/music-songbook/search"){t.value="",l.value="",d.value="songe";try{(i=(e=g.value)==null?void 0:e.resetTags)==null||i.call(e)}catch(h){console.log(h)}}return!0}),j(d,e=>{m.emit("changeTab",e)});const v=e=>{t.value=e;const i=c.value.indexOf(e);i>-1&&c.value.splice(i,1),e&&(c.value.unshift(e),c.value.length=Math.min(c.value.length,5)),m.emit("search",e)},b=(e,i="")=>{const h=Object.values(e).flat().filter(Boolean).join(",");l.value=h,m.emit("confirm",e),f.value=!1};return w(()=>{}),()=>s("div",{class:u.search},[s(S,{class:u.sticky},{default:()=>[s(M,{modelValue:t.value,showAction:!0,ref:o,onSearch:v,onFilter:()=>f.value=!0,filterDot:!!l.value,onClick:()=>{a.path==="/music-songbook"&&n.push({path:"/music-songbook/search"})}},null),a.path==="/music-songbook/search"&&s(C,{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:U(u.keywords,"van-hairline--bottom")},[s("div",{class:u.content},[c.value.map(e=>s(T,{round:!0,class:u.searchKeyword,key:e,onClick:()=>v(e)},L(e)?e:{default:()=>[e]}))]),s(O,{class:u.remove,name:"delete-o",onClick:()=>c.value=[]},null)]),s(V,null,null),s(K,{show:f.value,round:!0,closeable:!0,position:"bottom",style:{height:"60%"},teleport:"body","onUpdate:show":e=>f.value=e},{default:()=>[s(N,{ref:g,onConfirm:b,onCancel:()=>{}},null)]})])}}),ae=Object.freeze({__proto__:null,[Symbol.toStringTag]:"Module",mitter:m,default:W});export{ae as h,m,u as s};
|