UNPKG

need-miniprogram-ui

Version:

小程序UI组件库

1 lines 1.14 kB
Component({options:{virtualHost:!0,styleIsolation:"isolated"},properties:{style:{type:String},title:{type:String,value:""},fixed:{type:Boolean,value:!0},center:{type:Boolean,value:!0},color:{type:String,value:"rgb(var(--gray-rgb-99))"},home:{type:String,value:""},back:{type:Boolean,value:!0},autoBack:{type:Boolean,value:!0},placeholder:{type:Boolean,value:!0},glass:{type:Boolean,value:!1},custom:{type:Boolean,value:!1}},data:{isPC:!0,hasBack:!1,appendHeight:6},lifetimes:{ready:function(){this.render()}},methods:{render:function(){var t=this.data.appendHeight,e=getCurrentPages(),a=wx.getWindowInfo(),i=wx.getDeviceInfo(),i="mac"===i.platform||"windows"===i.platform,n=wx.getMenuButtonBoundingClientRect();n.right&&a&&a.windowWidth&&(t=a.windowWidth-n.right);a=n.top+n.height+t;this.setData({isPC:i,hasBack:1<e.length,appendHeight:t,fullHeight:a,navHeight:n.height+t}),this.triggerEvent("ready",{navigationBarHeight:a}),i&&wx.setNavigationBarTitle({title:this.data.title})},leftTap:function(){var t=this.data,e=t.hasBack,a=t.back,i=t.autoBack,t=t.home;t?wx.reLaunch({url:t}):a&&e&&(i?wx.navigateBack():this.triggerEvent("back"))}}});