2 lines
3.2 KiB
JavaScript
2 lines
3.2 KiB
JavaScript
|
"use strict";const e=require("../../../common/vendor.js"),t=require("../../index.js"),o=require("../../hooks/useModal.js");if(!Array){(e.resolveComponent("su-status-bar")+e.resolveComponent("uni-search-bar"))()}Math||((()=>"../su-status-bar/su-status-bar.js")+(()=>"../../../uni_modules/uni-search-bar/components/uni-search-bar/uni-search-bar.js"))();const l={__name:"su-navbar",props:{dark:{type:Boolean,default:!1},modelValue:{type:String,default:""},title:{type:String,default:""},titleAlign:{type:String,default:"center"},rightText:{type:String,default:""},leftIcon:{type:String,default:"left"},rightIcon:{type:String,default:""},fixed:{type:[Boolean,String],default:!0},placeholder:{type:[Boolean,String],default:!0},color:{type:String,default:""},backgroundColor:{type:String,default:""},opacity:{type:[Boolean,String],default:!1},opacityBgUi:{type:String,default:"bg-white"},statusBar:{type:[Boolean,String],default:!1},shadow:{type:[Boolean,String],default:!1},border:{type:[Boolean,String],default:!1},height:{type:[Number,String],default:44},leftWidth:{type:[Number,String],default:80},rightWidth:{type:[Number,String],default:0},tools:{type:String,default:"title"},defaultSearch:{type:String,default:""}},emits:["clickLeft","clickRight","clickTitle","search"],setup(l,{emit:r}){const a=e=>"number"==typeof e?e+"px":e,n=r,i=l;e.computed((()=>({width:t.sheep.$platform.capsule.width+"px",height:t.sheep.$platform.capsule.height+"px",margin:"0 "+(t.sheep.$platform.device.windowWidth-t.sheep.$platform.capsule.right)+"px"})));const u=e.computed((()=>i.defaultSearch));e.computed((()=>i.dark?i.backgroundColor?i.backgroundColor:i.dark?"#333":"#FFF":i.backgroundColor||"#FFF"));const c=e.computed((()=>i.dark?i.color?i.color:i.dark?"#fff":"#333":i.color||"#333")),s=e.computed((()=>a(i.height))),d=e.computed((()=>a(i.leftWidth)));function p(e){n("search",e.value)}e.computed((()=>a(i.rightWidth))),e.onLoad((()=>{e.index.report&&""!==i.title&&e.index.report("title",i.title)}));const f=t.sheep.$router.hasHistory();function h(){f?t.sheep.$router.back():t.sheep.$router.go("/modules/mall/index/index"),n("clickLeft")}function g(){n("clickTitle")}return(r,a)=>e.e({a:e.n(l.opacity?"":l.opacityBgUi),b:l.statusBar},(l.statusBar,{}),{c:l.leftIcon.length>0},l.leftIcon.length>0?e.e({d:e.unref(f)},(e.unref(f),{}),{e:e.o(h),f:e.o(((...t)=>e.unref(o.showMenuTools)&&e.unref(o.showMenuTools)(...t)))}):{},{g:"left"===l.titleAlign&&l.title.length&&"WechatOfficialAccount"!==e.unref(t.sheep).$platform.name},"left"===l.titleAlign&&l.title.length&&"WechatOfficialAccount"!==e.unref(t.sheep).$platform.name?{h:e.t(l.title),i:c.value,j:!l.leftIcon.length>0?1:""}:{},{k:d.value,l:"search"===l.tools},"search"===l.tools?{m:e.o(p),n:e.o((e=>u.value=e)),o:e.p({radius:20,placeholder:"请输入关键词",cancelButton:"none",modelValue:u.value})}:e.e({p:"title"===l.tools&&"center"===l.titleAlign&&l.title.length},"title"===l.tools&&"center"===l.titleAlign&&l.title.length?{q:e.t(l.title),r:c.value}:{},{s:e.o(g)}),{t:c.value,v:s.value,w:l.backgroundColor,x:l.fixed?1:"",y:l.shadow?1:"",z:l.border?1:"",A:l.placeholder},l.placeholder?e.e({B:l.statusBar},(l.statusBar,{}),{C:s.value}):{},{D:l.dark?1:""})}},r=e._export_sfc(l,[["__scopeId","data-v-b9cafd38"]]);wx.createComponent(r);
|