找到 uview 里面的 组件
然后 prop里面自定义一个参数 默认是关闭的
openTran:{
type:Boolean,
default:false
}
计算属性里 判断
centerStyle() {
let style = {};
style.width = this.width ? this.getUnitValue(this.width) : this.getUnitValue(this.length);
// 中部弹出的模式,如果没有设置高度,就用auto值,由内容撑开高度
style.height = this.height ? this.getUnitValue(this.height) : 'auto';
style.zIndex = this.uZindex;
style.marginTop = `-${this.$u.addUnit(this.negativeTop)}`;
if (this.borderRadius) {
style.borderRadius = `${this.borderRadius}rpx`;
// 不加可能圆角无效
style.overflow = 'hidden';
}
this.openTran?style.backgroundColor = 'rgba(255,255,255,0)':style.backgroundColor = 'rgba(255,255,255,1)'
return style;
}
然后查看效果 已经变成透明了
<u-popup mode="center" v-model="showShare" width="600rpx" height="1000rpx" :openTran="true">
</u-popup>