1 |
- import{d as _,V as c,a2 as y,_ as k,a3 as x,U as j,a4 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.d36f0b16.js";/* empty css *//* empty css *//* empty css *//* empty css */import{C as M}from"./index.34c374cf.js";import{c as I}from"./index.e3e3fcfd.js";import{c as U}from"./index.926ca9c5.js";import{S as N}from"./select-tag.a431718b.js";import{g as z}from"./music.8b0fc909.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(i){i(a)}),(t=o.get("*"))&&t.slice().map(function(i){i(n,a)})}}}const H="_search_x5fbt_1",P="_sticky_x5fbt_9",A="_title_x5fbt_15",D="_keywords_x5fbt_21",F="_content_x5fbt_28",G="_searchKeyword_x5fbt_38",L="_remove_x5fbt_46";var l={search:H,sticky:P,title:A,keywords:D,content:F,searchKeyword:G,remove:L};function W(o){return typeof o=="function"||Object.prototype.toString.call(o)==="[object Object]"&&!R(o)}const d=B(),v=c();var $=_({name:"MusicSearchHeader",setup(){const o=c();localStorage.setItem("behaviorId",z());const n=y(),a=k();c(!1);const t=c(""),i=c("");c([]),c([]);const u=c(!1),r=I("music-search",[]),f=c("songe");x(()=>{a.path==="/music-songbook/search"&&(t.value="",i.value="",v.value.resetTags())}),j(f,e=>{d.emit("changeTab",e)});const h=e=>{t.value=e;const m=r.value.indexOf(e);m>-1&&r.value.splice(m,1),e&&(r.value.unshift(e),r.value.length=Math.min(r.value.length,5)),d.emit("search",e)},b=(e,m="")=>{const g=Object.values(e).flat().filter(Boolean).join(",");i.value=g,d.emit("confirm",e),u.value=!1};return w(()=>{}),()=>s("div",{class:l.search},[s(S,{class:l.sticky},{default:()=>[s(M,{modelValue:t.value,showAction:!0,ref:o,onSearch:h,onFilter:()=>u.value=!0,filterDot:!!i.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:f.value,"onUpdate:active":e=>f.value=e,onChange:e=>f.value=e},{default:()=>[s(p,{title:"\u5355\u66F2",name:"songe"},null),s(p,{title:"\u4E13\u8F91",name:"album"},null)]})]}),r.value.length>0&&a.path==="/music-songbook/search"&&s("div",{class:U(l.keywords,"van-hairline--bottom")},[s("div",{class:l.content},[r.value.map(e=>s(T,{round:!0,class:l.searchKeyword,key:e,onClick:()=>h(e)},W(e)?e:{default:()=>[e]}))]),s(O,{class:l.remove,name:"delete-o",onClick:()=>r.value=[]},null)]),s(V,null,null),s(K,{show:u.value,round:!0,closeable:!0,position:"bottom",style:{height:"60%"},teleport:"body","onUpdate:show":e=>u.value=e},{default:()=>[s(N,{ref:v,onConfirm:b,onCancel:()=>{}},null)]})])}}),ae=Object.freeze({__proto__:null,[Symbol.toStringTag]:"Module",mitter:d,default:$});export{ae as h,d as m,l as s};
|