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.
This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.
< template >
< uni -popup ref = "popupRef" >
< view class = "popup-content" >
< uni -icons class = "closeIcon" @click.stop ="close" type = "close" color = "#86ACFE" size = "36" > < / u n i - i c o n s >
< image class = "systemBG" src = "/static/systemBG.png" mode = "aspectFill" > < / image >
< button class = "detailBtn" > 查看详情 < / button >
< / view >
< / u n i - p o p u p >
< / template >
< script setup >
import { ref , watch , onMounted } from 'vue'
defineOptions ( { name : "customizedPopup" } )
const props = defineProps ( {
isOpen : {
type : Boolean ,
default : false
}
} )
const popupRef = ref ( null )
watch ( ( ) => props . isOpen , ( newVal , oldVal ) => {
if ( ! popupRef . value ) { // 确保组件实例已存在( 避免null错误)
console . warn ( '弹窗组件尚未初始化完成' ) ;
return ;
}
if ( newVal ) { // 根据新值控制弹窗
popupRef . value . open ( ) ; // 显示弹窗
} else {
popupRef . value . close ( ) ; // 隐藏弹窗
}
} , { immediate : true } )
onMounted ( ( ) => {
} )
const close = ( ) => {
popupRef . value . close ( ) ;
}
< / script >
< style lang = "scss" scoped >
. popup - content {
width : 640 rpx ;
height : 844 rpx ;
position : relative ;
}
. systemBG {
width : 640 rpx ;
height : 844 rpx ;
}
. closeIcon {
position : absolute ;
top : 26 rpx ;
right : 26 rpx ;
}
. detailBtn {
position : absolute ;
bottom : 46 rpx ;
left : 50 % ;
transform : translate ( - 50 % , 0 ) ;
width : 207 rpx ;
height : 77 rpx ;
background : # 3 A71FF ;
border - radius : 45 rpx 45 rpx 45 rpx 45 rpx ;
font - weight : 500 ;
font - size : 32 rpx ;
color : # FFFFFF ;
@ include flexBox ( ) ;
}
< / style >