vue3 設置el-dialog height超過滾動條

 

方法一:

<style scoped>
 ::v-deep .el-dialog .el-dialog-body{
    height: 500px;
    overflow-y: auto;
 }
</style>

 

如果要設置動態的高度話,則要在setup裏面設置

 

<script >
  export default defineComponent({
    setup:{
        const cssContent=ref({height:'100%',overflowY:''})
        const init=()=>{
            cssContent.value.height='500px'
            cssContent.value.overflowY='auto'
        }
        init()
        return {
            cssContent,
            init
        }
    }
  })
</script>
<style scoped>
 ::v-deep .el-dialog .el-dialog-body{
    height: v-bind('cssContent.height');
    overflow-y: v-bind('cssContent.overflowY');
 }
</style>

 

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章