import{d as x,aI as w,r as s,j as C,Y as b,ai as i,o as c,M as l,O as R,P as S,V as k,u,a as D,R as L}from"./vue.1RczIYhx.js";import{i as B,L as O}from"./echarts.DoXO02ct.js";import{g as P}from"./api._G-kxOoH.js";import{u as V}from"./useResponse.DqThFJSa.js";import{_ as z}from"./_plugin-vue_export-helper.DlAUqK2U.js";import"./index.DoJnwA7v.js";import"./elementPlus.CqHltQSO.js";const A=x({__name:"PriceChart",props:{asin:String,country:String},setup(f){const p=f,{asin:d,country:m}=p;let a=w("chartRef"),e=null,o=null,n=s([]);const h=s(!1);C(()=>{g(),_()}),b(()=>{o==null||o.disconnect(),e==null||e.dispose()});function r(){if(!e||n.value.length===0)return;const t={title:{text:"商品价格趋势"},tooltip:{trigger:"axis"},legend:{data:["价格"]},grid:{top:"20%",left:"10%",right:"10%",bottom:"10%"},dataset:{dimensions:["create_datetime","new_val"],source:n.value},xAxis:{type:"category"},yAxis:[{type:"value",name:"价格",nameTextStyle:{fontWeight:"bold",fontSize:14,color:"#333"},splitLine:{show:!0},axisLine:{show:!0,lineStyle:{color:"#333",width:1}}}],series:[{name:"价格",type:"line",areaStyle:{color:new O(0,0,0,1,[{offset:0,color:"rgba(84,112,198, 0.4)"},{offset:1,color:"rgba(84,112,198, 0.1)"}])}}]};e.setOption(t)}function _(){a.value&&(e=B(a.value),r(),o=new ResizeObserver(()=>{e==null||e.resize()}),a.value&&o.observe(a.value))}async function g(){const t=await V(P,{asin:d,country_code:m},h);t.code===2e3&&t.data&&(n.value=t.data,r())}return(t,I)=>{const y=i("el-empty"),v=i("el-card");return c(),l(v,{class:"border-none mt-2"},{default:R(()=>[S(D("div",{ref_key:"chartRef",ref:a,class:"chart"},null,512),[[k,u(n).length>0]]),u(n).length==0?(c(),l(y,{key:0,description:"暂无数据",class:"chart"})):L("",!0)]),_:1})}}}),Y=z(A,[["__scopeId","data-v-abacdadf"]]);export{Y as default};
