mini/component/share-modal-view/index.js

60 lines
1.2 KiB
JavaScript

// component/share-modal-view.js
Component({
externalClasses:'custom-class',
/**
* 组件的属性列表
*/
properties: {
show:{
type:Boolean,
value:false
},
data:Object,
buttonType:String,
pageHeight:Number
},
/**
* 组件的初始数据
*/
data: {
maxHeight:0
},
/**
* 组件的方法列表
*/
methods: {
tryon(){
this.triggerEvent('tryon')
},
share(){
const pages = getCurrentPages();
const currentPage = pages[pages.length - 1];
currentPage.onShareAppMessage = ()=>{
return {
title:'我的美搭,分享给你',
imageUrl:this.properties.data.completion_url,
path:`/pages/try/index/index?shared_history_id=${this.properties.data.id}`
}
}
},
afterLeave(){
this.triggerEvent('afterLeave')
},
closeModal(){
this.selectComponent('#modalView').cancelButtonTap();
}
},
lifetimes:{
ready(){
const windowInfo = wx.getWindowInfo();
console.log(this.properties.pageHeight,windowInfo.windowHeight);
this.setData({
maxHeight:(this.properties.pageHeight||windowInfo.windowHeight)-40
})
}
}
})