展品维保小程序前端代码接口
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

60 lines
1.7 KiB

export default {
data() {
return {
containerHeight: 0
}
},
methods: {
// 自定义分享内容
mixinCustomShare() {
return {
}
},
// 计算容器高度
calculateContainerHeight() {
const systemInfo = uni.getSystemInfoSync();
const statusBarHeight = systemInfo.statusBarHeight || 0;
const navigationBarHeight = 44; // 默认导航栏高度
this.containerHeight = 2 * (systemInfo.windowHeight - statusBarHeight - navigationBarHeight);
console.log('最后的容器高度为', this.containerHeight/2 + 'px', '状态栏高度:', statusBarHeight + 'px', 'nav导航栏高度:', navigationBarHeight + 'px');
},
},
computed: {
// 获取全局配置的文本
configParamText() {
return key => this.$store.state.configList[key]?.paramText || '默认文本'
},
// 获取全局配置的图片
configParamImage() {
return key => this.$store.state.configList[key]?.paramImage || '/static/默认图片.png'
},
// 获取全局配置的富文本
configParamTextarea() {
return key => this.$store.state.configList[key]?.paramTextarea || '默认富文本'
},
// 默认的全局分享参数
GShare() {
return {
title: this.configParamText('app_name'),
desc: this.configParamText('share_desc'),
imageUrl: this.configParamImage('app_logo'),
path: '/pages/index/index'
}
}
},
onShareAppMessage() {
return {
...this.GShare,
...this.mixinCustomShare()
}
},
onShareTimeline() {
return {
...this.GShare,
...this.mixinCustomShare()
}
},
onLoad() {
// this.calculateContainerHeight();
}
}