Skip to content
Toggle navigation
Toggle navigation
This project
Loading...
Sign in
dev
/
pingan-life-index-pro
Go to a project
Toggle navigation
Toggle navigation pinning
Projects
Groups
Snippets
Help
Project
Activity
Repository
Pipelines
Graphs
Issues
0
Merge Requests
0
Wiki
Network
Create a new issue
Builds
Commits
Issue Boards
Files
Commits
Network
Compare
Branches
Tags
0d4ba490
authored
2019-11-12 17:10:19 +0800
by
simon
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
模态框组件
1 parent
b94377f9
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
153 additions
and
4 deletions
src/components/modal-comp/modal-comp.js
src/components/modal-comp/modal-comp.scss
src/components/modal-comp/modal-comp.vue
src/components/modal-comp/modal-comp.js
View file @
0d4ba49
...
...
@@ -6,6 +6,69 @@ import {
export
default
{
props
:
{
// 是否显示组件
visible
:
{
type
:
Boolean
,
default
:
true
,
},
// 标题名称 需要再 assets/images/common/ 目录下添加图标
icon
:
{
type
:
String
,
default
:
"succ"
,
},
// 标题,不建议使用
title
:
{
type
:
String
,
default
:
""
,
},
// 文案
content
:
{
type
:
String
,
default
:
""
,
},
// 确认文案
confirmText
:
{
type
:
String
,
default
:
"確認"
,
},
// 取消文案
cancelText
:
{
type
:
String
,
default
:
"取消"
,
},
// 是否显示确认按钮
showConfirm
:
{
type
:
Boolean
,
default
:
true
,
},
// 是否显示取消按钮
showCancel
:
{
type
:
Boolean
,
default
:
true
,
},
// 是否显示遮罩层
overlayShow
:
{
type
:
Boolean
,
default
:
true
,
},
// 确定按钮回调方法
confirm
:
{
type
:
Function
,
default
:
null
},
// 取消按钮回调方法
cancel
:
{
type
:
Function
,
default
:
null
},
// 点击蒙层回调方法
overlay
:
{
type
:
Function
,
default
:
null
}
},
data
()
{
return
{
key
:
'value'
...
...
@@ -13,9 +76,26 @@ export default {
},
components
:
{},
methods
:
{
// 点击确认
onConfirmHandler
()
{
if
(
this
.
confirm
)
{
this
.
confirm
();
}
},
// 点击取消
onCancelHandler
()
{
if
(
this
.
cancel
)
{
this
.
cancel
();
}
},
// 点击蒙层
onOverLayHandler
()
{
if
(
this
.
overlay
)
{
this
.
overlay
();
}
},
initData
()
{}
},
mounted
()
{},
created
()
{
}
created
()
{}
}
...
...
src/components/modal-comp/modal-comp.scss
View file @
0d4ba49
@import
'@/styles/_support'
;
.comp
{
position
:
absolute
;
z-index
:
999
;
width
:
100%
;
height
:
100%
;
@extend
.fcc
;
text-align
:
center
;
}
.overlay
{
position
:
absolute
;
width
:
100%
;
height
:
100%
;
background
:
rgba
(
$color
:
#000000
,
$alpha
:
0
.7
);
}
.modal
{
position
:
relative
;
@extend
.bb
;
width
:
36rem
;
min-height
:
22
.5rem
;
border-radius
:
1
.25rem
;
background-color
:
#ffffff
;
padding
:
4
.5rem
2rem
2
.5rem
;
&
-title
{
margin-bottom
:
3rem
;
color
:
$cOrange
;
font-size
:
24px
;
font-weight
:
bold
;
}
&
-icon-wrap
{
@extend
.fcc
;
}
&
-content
{
color
:
$cOrange
;
font-size
:
18px
;
font-weight
:
bold
;
}
&
-btn-wrap
{
display
:
flex
;
justify-content
:
center
;
.btn
{
@include
btc2
(
12rem
,
3
.6rem
,
16px
);
margin
:
2rem
1rem
0
;
@extend
.pointer
;
}
}
}
.hide
{
display
:
none
;
}
...
...
src/components/modal-comp/modal-comp.vue
View file @
0d4ba49
<
template
>
<div
class=
"comp"
>
modal-comp
<div
class=
"comp"
:class=
"
{'hide' : !visible }">
<div
@
click=
"onOverLayHandler()"
class=
"overlay"
v-if=
"overlayShow"
></div>
<div
class=
"modal"
>
<div
v-if=
"title"
class=
"modal-title"
>
{{
title
}}
</div>
<div
class=
"modal-icon-wrap"
>
<img
:src=
"require('@assets/images/common/icon-'+icon+'.png')"
>
</div>
<div
class=
"modal-content"
>
{{
content
}}
</div>
<div
class=
"modal-btn-wrap"
>
<div
@
click=
"onCancelHandler()"
v-if=
"showCancel"
class=
"btn"
>
{{
cancelText
}}
</div>
<div
@
click=
"onConfirmHandler()"
v-if=
"showConfirm"
class=
"btn"
>
{{
confirmText
}}
</div>
</div>
</div>
</div>
</
template
>
...
...
Please
register
or
sign in
to post a comment