1***@qq.com
1***@qq.com
  • 发布:2024-10-11 19:41
  • 更新:2024-10-11 19:41
  • 阅读:196

ref 在这个组件里不管放在哪都是null,延迟什么都试过了

分类:uni-app x

<template>
<view @touchmove.stop="" class="mask">
<view ref="main" :class="mode" :style="style" class="absolute transition-property-transform">
<slot ></slot>
</view>
</view>
</template>

<script>

export default {  
    props:{  
        bgStyle:{  
            type:Object,  
            default:{},  
        },  
        mode:{  
            type:String,  
            default:'center',  
        },  
        show:{  
            type:Boolean,  
            default:false,  
        }  
    },  
    name:"mNavigation",  
    watch: {  
        show(newValue, oldValue) {  
            if (newValue === true) {  
                this.style={transform:"translateY(0%)"}  
            }else{  

            }  
        }  
    },  
    data() {  
        return {  
            style:{transform:"translateY(100%)"}  
        };  
    },  
    mounted() {  
        this.$nextTick(() => {  
            setTimeout(()=>{  
                console.log(this.$refs['main']);  
            },3000)  

          });  
    },  
    methods:{  
        getStyle(){  

        }  
    }  
}  

</script >

<style lang="scss" scoped>
.left{
left: 0;
}
.right{
right: 0;
}
.top{
top: 0;
}
.bottom{
bottom: 0;
}
.center{
position: absolute;
alignItems: center;
justify-content: center;
top: 0;
left: 0;
right: 0;
bottom: 0;
}
</style>

2024-10-11 19:41 负责人:无 分享
已邀请:

要回复问题请先登录注册