el-dialog对话框设置全屏

本文介绍了如何使用Vue.js实现一个可全屏展示并允许自定义标题和菜单的Dialog组件,通过`fullscreen`属性和`dialogFullScreen`状态管理来控制Dialog的全屏显示,同时展示了CSS样式如何根据全屏或非全屏模式调整布局。
摘要由CSDN通过智能技术生成

在这里插入图片描述
在这里插入图片描述

fullscreen:是否为全屏 Dialog

<template>
  <div class="hello">
    <el-button type="text" @click="dialogVisible = true">点击打开 Dialog</el-button>

    <el-dialog
      :visible.sync="dialogVisible"
      :fullscreen="dialogFullScreen"
      :class="[dialogFullScreen ? 'fullscreen' : 'no_fullscreen']"
    >
      <template slot="title">
        <div class="custom_dialog_header">
          <span class="el_dialog_title">标题</span>
          <div class="custom_dialog_menu" @click="dialogFullScreen = !dialogFullScreen">
            <i class="el-icon-full-screen"></i>
          </div>
        </div>
      </template>
      <span>这是一段信息</span>
      <span slot="footer" class="dialog-footer">
        <el-button @click="dialogVisible = false">取 消</el-button>
        <el-button type="primary" @click="dialogVisible = false">确 定</el-button>
      </span>
    </el-dialog>
  </div>
</template>

<script>
export default {
  name: "fullSreen",
  data() {
    return {
      dialogVisible: false,
      dialogFullScreen: false
    };
  },
  methods: {}
};
</script>
<style lang="scss" scoped>
.fullscreen {
  /deep/ .el-dialog {
    width: 100%;
  }
}
.no_fullscreen {
  /deep/ .el-dialog {
    width: 40%;
  }
}
/deep/ .custom_dialog_header {
  display: flex;
  justify-content: space-between;
}
/deep/ .custom_dialog_menu {
  padding: 6px 30px 0 0;
}
/deep/ .custom_dialog_menu i {
  color: #909399;
  font-size: 15px;
}
/deep/ .el-icon-full-screen {
  cursor: pointer;
}
</style>

  • 1
    点赞
  • 13
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值