方法一:
<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>