Ant-Vue——modal对话框

在Vue3的项目里,组件库用的是Ant-design 3.2+版本

修改样式

需求是需要修改原生的 modal 样式

如果直接用类名 .ant-modal-body  去修改样式,会发现无法修改。因为默认不支持修改高度和外边距padding

所以需要:先通过 挂载元素 再css穿透/deep/ .ant-modal-body{} 修改样式,这样不会影响到别的页面中modal中的样式。

关键点:

        ref="mymodal" ,

        :getContainer = '()=>$refs.mymodal' ,

        div /deep/ .ant-modal-body{ }

示例如下:

<template>
  <div class="cumuDownModal" ref="mymodal">
    <a-modal :visible="visible" :getContainer = '()=>$refs.mymodal'>
      <div>hahahh</div>
    </a-modal>
  </div>
</template>
<style lang="less" scoped>
  div /deep/ .ant-modal-body{
   padding: 0;
  }
</style>

参考博客:https://www.cnblogs.com/SunshineKimi/p/14690763.html

相关推荐

  1. Ant-Vue——modal对话框

    2024-07-11 20:28:01       23 阅读
  2. uViw Dialog 对话框

    2024-07-11 20:28:01       64 阅读
  3. Qt对话框

    2024-07-11 20:28:01       59 阅读
  4. Android studio 之 对话框

    2024-07-11 20:28:01       53 阅读

最近更新

  1. docker php8.1+nginx base 镜像 dockerfile 配置

    2024-07-11 20:28:01       66 阅读
  2. Could not load dynamic library ‘cudart64_100.dll‘

    2024-07-11 20:28:01       70 阅读
  3. 在Django里面运行非项目文件

    2024-07-11 20:28:01       57 阅读
  4. Python语言-面向对象

    2024-07-11 20:28:01       68 阅读

热门阅读

  1. windows 修改 npmrc

    2024-07-11 20:28:01       22 阅读
  2. Python图形用户界面的文本文件加密工具

    2024-07-11 20:28:01       25 阅读
  3. [QT入门]树形视图控件

    2024-07-11 20:28:01       22 阅读
  4. Redis事件和整体框架

    2024-07-11 20:28:01       21 阅读
  5. House holder reflections and Givens rotations

    2024-07-11 20:28:01       20 阅读
  6. Python开发 ——循环中的 `continue` 语句

    2024-07-11 20:28:01       21 阅读
  7. Spring的bean的生命周期——bean的创建与销毁

    2024-07-11 20:28:01       21 阅读