123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172 |
- const { isEmpty } = require("../../utils/util")
- // components/customPage/customPage.js
- Component({
- options:{
- multipleSlots: true
- },
- /**
- * 组件的属性列表
- */
- properties: {
- headBgImage: {
- type: String,
- value: ''
- },
- headBgColor: {
- type: String,
- value: ''
- }
- },
- /**
- * 组件的初始数据
- */
- data: {
- bodyImageHeight: 0
- },
- attached: function() {
- let dwObj = wx.getMenuButtonBoundingClientRect()
- let navHeight_ = (dwObj.top + dwObj.height)
- let capsuleTop_ = dwObj.top
- const systemInfoSync = wx.getSystemInfoSync()
- const windowHeight = systemInfoSync.windowHeight
- const windowWidth = systemInfoSync.windowWidth;
- navHeight_ += capsuleTop_ / 8;
- let headStyle = "height:" + navHeight_ + "px;";
- if (this.data.headBgColor) {
- headStyle += "background-color:" + this.data.headBgColor +";"
- }
- console.log(windowWidth, systemInfoSync)
- this.setData({
- navHeight: navHeight_,
- capsuleTop:capsuleTop_,
- capHeight: dwObj.height,
- bodyHeight: windowHeight - navHeight_,
- windowWidth,
- windowHeight,
- headStyle,
- });
- },
- /**
- * 组件的方法列表
- */
- methods: {
- loadImage(e) {
- let { detail: {width, height} } = e
- let wB = this.data.windowWidth / width
- this.setData({
- bodyImageHeight: height * wB - this.data.navHeight
- })
- },
- handleReachBottom(e) {
- this.triggerEvent("reachbottom", e)
- }
- }
- })
|