elementui dialog固定高度
时间: 2023-07-22 12:57:46 浏览: 53
要在 ElementUI Dialog 中设置固定高度,可以使用 Dialog 组件的 `height` 属性。将 `height` 属性设置为一个具体的数值,例如 `300px`,可以固定 Dialog 的高度为 300 像素。
以下是一个示例代码:
```html
<template>
<div>
<el-button @click="openDialog">打开对话框</el-button>
<el-dialog :visible.sync="dialogVisible" :height="dialogHeight">
<!-- 对话框内容 -->
</el-dialog>
</div>
</template>
<script>
export default {
data() {
return {
dialogVisible: false,
dialogHeight: '300px'
};
},
methods: {
openDialog() {
this.dialogVisible = true;
}
}
};
</script>
```
在上面的示例中,通过 `:height="dialogHeight"` 将 `dialogHeight` 属性值传递给 Dialog 组件的 `height` 属性,从而使 Dialog 的高度固定为 300 像素。你可以根据需求修改 `dialogHeight` 的值来调整 Dialog 的高度。