2 lines
2.2 KiB
JavaScript
2 lines
2.2 KiB
JavaScript
/*! For license information please see 4746d0d141219433ff9218e1803cf087.js.LICENSE.txt */
|
|
"use strict";(wx.webpackJsonp=wx.webpackJsonp||[]).push([["sub-common/4746d0d141219433ff9218e1803cf087"],{"./src/components/navBar/index.tsx":function(e,t,n){var s=n("./node_modules/@babel/runtime/helpers/esm/slicedToArray.js"),c=n("./node_modules/@tarojs/plugin-platform-weapp/dist/components-react.js"),o=n("./node_modules/@tarojs/taro/index.js"),r=n.n(o),a=n("./node_modules/react/cjs/react.production.min.js"),u=n("./src/components/navBar/index.module.scss"),i=n("./src/components/iconfont/iconfont.tsx"),l=n("./node_modules/react/cjs/react-jsx-runtime.production.min.js");t.default=function NavBar(e){var t=e.children,n=e.hasLeft,o=void 0!==n&&n,d=e.title,f=void 0===d?"":d,m=e.leftSlot,h=e.onClickLeftIcon,p=(0,a.useRef)(null),v=(0,a.useRef)(null),x=(0,a.useRef)(0),j=(0,a.useRef)(0),w=(0,a.useState)({}),g=(0,s.default)(w,2)[1],N=(0,a.useState)(0),y=(0,s.default)(N,2),B=y[0],k=y[1];(0,a.useEffect)((function(){v.current=r().getSystemInfoSync(),p.current=r().getMenuButtonBoundingClientRect(),j.current=v.current.screenWidth/750,g({}),function handleLayout(){var e=v.current,t=e.statusBarHeight,n=!!(e.system.toLowerCase().search("ios")+1);x.current=n?4:0;var s=p.current,c=s.top,o=s.height+2*(c-t)+t;console.log("height",o),k(o)}()}),[]);var V=(0,a.useMemo)((function(){var e;return null===(e=p.current)||void 0===e?void 0:e.height}),[p.current]),_=(0,a.useMemo)((function(){var e;return null===(e=p.current)||void 0===e?void 0:e.top}),[p.current]);return(0,l.jsx)(c.View,{className:u.default.navBarContainer,style:{height:"".concat(B+x.current,"px")},children:(0,l.jsxs)(c.View,{className:u.default.navBar,style:{height:"".concat(V,"px"),marginTop:"".concat(_,"px")},children:[(0,l.jsx)(c.View,{className:u.default.left_view,children:o&&m?m:(0,l.jsxs)(c.View,{className:u.default.back,onClick:function handleClickLeftIcon(){null==h||h()},children:[(0,l.jsx)(i.default,{name:"icon-zhankai",size:50,color:"#000000",customStyle:{transform:"rotate(90deg)"}}),(0,l.jsx)(c.View,{className:u.default.iconName,children:"返回"})]})}),(0,l.jsx)(c.View,{className:u.default.title,children:f||t}),(0,l.jsx)(c.View,{className:u.default.right_view})]})})}}}]); |