当前位置: 首页 > Web前端 > vue.js

自己封装对话框组件

时间:2023-04-01 02:09:56 vue.js

.common-dialog{.el-dialog{margin-top:8vh!important;左填充:12px;填充右:29px;.el-dialog__header{高度:58px;行高:58px;字体大小:17px;-底部:1pxsolid#eeeeee;填充:0px0px0px10px;.el-dialog__headerbtn{top:15px;}.el-dialog__close.el-icon.el-icon-close{字体大小:17px;字体粗细:粗体;}}.el-dialog__body{填充:16px20px0px12px;}.el-dialog__footer{高度:72px;行高:72px;填充:0px;border-top:1pxsolid#eeeeee;.el-button.el-button--默认{宽度:73px;边界半径:6px;&:hover,&:focus{背景颜色:#736df1;颜色:#ffffff;}}.confirm-button{背景色:#736df1;颜色:#ffffff;}.cancel-button{颜色:#999999;}}}}在项目中,我们经常要求各个页面的样式统一,所以在使用组件的时候,大多采用封装方式如果有提交按钮则必须通过//如果内部引用form表单,可以为设置一个通用样式//form-item-half可以设置一行的两个表单组件显示half-right一行的右边需要加上,左边side不需要添加-->.common-dialog{.el-dialog{margin-top:8vh!important;左填充:12px;填充右:29px;.el-dialog__header{高度:58px;行高:58px;字体大小:17px;-底部:1pxsolid#eeeeee;填充:0px0px0px10px;.el-dialog__headerbtn{top:15px;}.el-dialog__close.el-icon.el-icon-close{字体大小:17px;字体粗细:粗体;}}.el-dialog__body{填充:16px20px0px12px;}.el-dialog__footer{高度:72px;行高:72px;填充:0px;border-top:1pxsolid#eeeeee;.el-button.el-button--默认{宽度:73px;边界半径:6px;&:hover,&:focus{背景颜色:#736df1;颜色:#ffffff;}}.confirm-button{背景色:#736df1;颜色:#ffffff;}.cancel-button{颜色:#999999;}}}}.refacte-quick-form{*{box-sizing:border-box;}.el-form-item.is-required{.el-form-item__label{&:before{content:''}&:after{content:'*';颜色:#F56C6C;位置:相对;底部:3px;左:3px;}}}.el-form-item{margin-bottom:22px;}.el-input__inner{高度:36px;宽度:888px;字体大小:13px;}.el-textarea__inner{宽度:888px;}.el-form-item.form-item-half{显示:内联块;.el-input__inner{宽度:361px;}}.el-form-item.form-item-half.half-right{margin-left:59px;}.el-form-item__label{width:105px!important;文本对齐:左;字体大小:14px;}.el-form-item__content{margin-left:105px!important;}}可添加拖动data(){return{dw:0,dh:0,xp:0,yp:0,canResizable:false,canDraggable:false,isShow:false,dialogVisible:false,confirming:false}},计算(){const{clientWidth,clientHeight}=document.bodyconst{width,height}=this.customStyleconstfs=clientWidth/10constw=width*fs/192consth=height*fs/192constx=clientWidth/2-w/2consty=clientHeight/2-h/2this.dw=wthis.dh=hthis.xp=xthis.yp=y}**将时间转换成字符串时间**toLocaleString()