<view style="height: 100%; width: 100%;"> <page-container show="{{show}}" overlay='true' duration="{{duration}}" position="center" close-on-slide-down="true" custom-style="height:{{height}};width:{{width}};margin-left:{{marginLeft}};margin-top:{{marginTop}}; margin-right:25%; {{customStyle}}" overlay-style="background-color: rgba(0, 0, 0, 0.7); filter: blur(4px);" bind:beforeenter="modelBeforeEnter"> <view id="pageContainerInner" style="height: 100%; width: 100%;"> <slot></slot> </view> </page-container> </view> methods: { modelBeforeEnter(){ var query = wx.createSelectorQuery().in(this); query.select('#pageContainerInner').boundingClientRect(rect => { this.setData({ marginTop: `${(wx.getSystemInfoSync().windowHeight - rect.height) / 2}px`, marginLeft: `${( wx.getSystemInfoSync().windowWidth - rect.width) / 2}px` }) }).exec(); } }
page-container这个组件怎么实现水平垂直居中?page-container这个组件怎么实现水平垂直居中?
2022-04-01