1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071 |
- <script>
- const menuButtonInfo = wx.getMenuButtonBoundingClientRect(); //胶囊相关信息
- const menuButtonHeight = menuButtonInfo.height; //胶囊高度
- const menuButtonTop = menuButtonInfo.top; //胶囊距上边界距离
- export default {
- onLaunch: function() {
- //自定义导航栏适配机型
- const systemInfo = wx.getSystemInfoSync();
- // 胶囊按钮位置信息
- const menuButtonInfo = wx.getMenuButtonBoundingClientRect();
- // 导航栏高度 = 状态栏到胶囊的间距(胶囊距上距离-状态栏高度) * 2 + 胶囊高度 + 状态栏高度
- this.globalData.navBarHeight = (menuButtonInfo.top - systemInfo.statusBarHeight) * 2 + menuButtonInfo.height + systemInfo.statusBarHeight;
- this.globalData.menuBotton = menuButtonInfo.top - systemInfo.statusBarHeight;
- this.globalData.menuRight = systemInfo.screenWidth - menuButtonInfo.right;
- this.globalData.menuHeight = menuButtonInfo.height;
-
-
- let f = uni.canIUse('getUpdateManager')
- if(f) {
- const _u = uni.getUpdateManager()
- _u.onCheckForUpdate(res => {
- console.log(res.hasUpdate)
- if(res.hasUpdate) {
- _u.onUpdateReady(() => {
- uni.showModal({
- title: '更新提示',
- content: '新版本已发布,请重启当前应用!',
- showCancel: false,
- success(c_res) {
- if(c_res.confirm) {
- _u.applyUpdate()
- }
- }
- })
- })
- }
- })
- _u.onUpdateFailed(() => {
- uni.showModal({
- title: '发现新版本',
- content: '请删除当前小程序,重新搜索打开'
- })
- })
- }
- },
- globalData: {
- navBarHeight: 0, // 导航栏高度
- menuBotton: 0, // 胶囊距底部间距(保持底部间距一致)
- menuRight: 0, // 胶囊距右方间距(方保持左、右间距一致)
- menuHeight: 0 // 胶囊高度(自定义内容可与胶囊高度保证一致)
- },
- onShow: function() {},
- onHide: function() {}
- };
- </script>
- <style lang="scss">
- @import 'uview-ui/index.scss';
- @import './static/css/icon.css';
- @import './static/css/editor-icon.css';
- page {
- height: 100%;
- min-height: 100%;
- background-color: #f9f9f9;
- .container {
- width: 100%;
- display: flex;
- flex-direction: column;
- justify-content: flex-start;
- }
- }
- </style>
|