Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
E
Element
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
CI / CD Analytics
Repository Analytics
Value Stream Analytics
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
林焕东
Element
Commits
5c90dbd2
Commit
5c90dbd2
authored
Aug 11, 2016
by
qingwei.li
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'next' of github.com:eleme/element-ui into next
parents
0d5bcfdd
c6cf12ff
Changes
11
Hide whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
111 additions
and
82 deletions
+111
-82
examples/docs/message-box.md
examples/docs/message-box.md
+12
-12
examples/docs/notification.md
examples/docs/notification.md
+14
-14
packages/alert/src/main.vue
packages/alert/src/main.vue
+13
-7
packages/message-box/package.json
packages/message-box/package.json
+1
-1
packages/message-box/src/main.js
packages/message-box/src/main.js
+9
-4
packages/message-box/src/main.vue
packages/message-box/src/main.vue
+37
-22
packages/notification/src/main.js
packages/notification/src/main.js
+3
-2
packages/notification/src/main.vue
packages/notification/src/main.vue
+17
-12
packages/theme-default/src/alert.css
packages/theme-default/src/alert.css
+2
-5
packages/theme-default/src/message-box.css
packages/theme-default/src/message-box.css
+2
-2
packages/theme-default/src/notification.css
packages/theme-default/src/notification.css
+1
-1
No files found.
examples/docs/message-box.md
View file @
5c90dbd2
...
...
@@ -65,11 +65,11 @@
</script>
## 基本用法
<el-button
@
click=
"open"
>
打开 Alert
</el-button>
<el-button @click
.native
="open">打开 Alert</el-button>
```
html
<template>
<el-button
@
click=
"open"
>
打开 Message Box
</el-button>
<el-button
@
click
.native
=
"open"
>
打开 Message Box
</el-button>
</template>
<script>
...
...
@@ -85,11 +85,11 @@
## 返回 Promise
<el-button
@
click=
"open2"
>
打开 alert
</el-button>
<el-button @click
.native
="open2">打开 alert</el-button>
```
html
<template>
<el-button
@
click
=
"open4
"
>
打开 alert
</el-button>
<el-button
@
click
.native=
"open2
"
>
打开 alert
</el-button>
</template>
<script>
...
...
@@ -105,11 +105,11 @@
</script>
```
<el-button
@
click=
"open3"
>
打开 confirm
</el-button>
<el-button @click
.native
="open3">打开 confirm</el-button>
```
html
<template>
<el-button
@
click
=
"open5
"
>
打开 confirm
</el-button>
<el-button
@
click
.native=
"open3
"
>
打开 confirm
</el-button>
</template>
<script>
...
...
@@ -132,11 +132,11 @@
}
</script>
```
<el-button
@
click=
"open4"
>
打开 prompt
</el-button>
<el-button @click
.native
="open4">打开 prompt</el-button>
```
html
<template>
<el-button
@
click
=
"open6
"
>
打开 prompt
</el-button>
<el-button
@
click
.native=
"open4
"
>
打开 prompt
</el-button>
</template>
<script>
...
...
@@ -157,11 +157,11 @@
</script>
```
<el-button
@
click=
"open5"
>
打开 Message Box
</el-button>
<el-button @click
.native
="open5">打开 Message Box</el-button>
```
html
<template>
<el-button
@
click
=
"open3
"
>
打开 Message Box
</el-button>
<el-button
@
click
.native=
"open5
"
>
打开 Message Box
</el-button>
</template>
<script>
...
...
@@ -183,11 +183,11 @@
## 更多配置项
<el-button
@
click=
"open6"
>
打开 Message Box
</el-button>
<el-button @click
.native
="open6">打开 Message Box</el-button>
```
html
<template>
<el-button
@
click
=
"open2
"
>
打开 Message Box
</el-button>
<el-button
@
click
.native=
"open6
"
>
打开 Message Box
</el-button>
</template>
<script>
...
...
examples/docs/notification.md
View file @
5c90dbd2
...
...
@@ -74,12 +74,12 @@
## 基本用法
<div
class=
"demo-box demo-notification"
>
<el-button
:plain=
"true"
v-on:click=
"open"
>
点击展示 Notification
</el-button>
<el-button
:plain=
"true"
v-on:click
.native
=
"open"
>
点击展示 Notification
</el-button>
</div>
```
html
<template>
<el-button
:plain=
"true"
v-on:click=
"open"
>
点击展示 Notification
</el-button>
<el-button
:plain=
"true"
v-on:click
.native
=
"open"
>
点击展示 Notification
</el-button>
</template>
<script>
...
...
@@ -99,18 +99,18 @@
## 带有 icon
<div
class=
"demo-box demo-notification"
>
<el-button
:plain=
"true"
v-on:click=
"open2"
>
成功
</el-button>
<el-button
:plain=
"true"
v-on:click=
"open3"
>
警告
</el-button>
<el-button
:plain=
"true"
v-on:click=
"open4"
>
消息
</el-button>
<el-button
:plain=
"true"
v-on:click=
"open5"
>
错误
</el-button>
<el-button
:plain=
"true"
v-on:click
.native
=
"open2"
>
成功
</el-button>
<el-button
:plain=
"true"
v-on:click
.native
=
"open3"
>
警告
</el-button>
<el-button
:plain=
"true"
v-on:click
.native
=
"open4"
>
消息
</el-button>
<el-button
:plain=
"true"
v-on:click
.native
=
"open5"
>
错误
</el-button>
</div>
```
html
<template>
<el-button
:plain=
"true"
v-on:click=
"open2"
>
成功
</el-button>
<el-button
:plain=
"true"
v-on:click=
"open3"
>
警告
</el-button>
<el-button
:plain=
"true"
v-on:click=
"open4"
>
消息
</el-button>
<el-button
:plain=
"true"
v-on:click=
"open5"
>
错误
</el-button>
<el-button
:plain=
"true"
v-on:click
.native
=
"open2"
>
成功
</el-button>
<el-button
:plain=
"true"
v-on:click
.native
=
"open3"
>
警告
</el-button>
<el-button
:plain=
"true"
v-on:click
.native
=
"open4"
>
消息
</el-button>
<el-button
:plain=
"true"
v-on:click
.native
=
"open5"
>
错误
</el-button>
</template>
<script>
...
...
@@ -154,12 +154,12 @@
## 不会自动关闭
<div
class=
"demo-box demo-notification"
>
<el-button
:plain=
"true"
v-on:click=
"open6"
>
不会自动关闭的 Notification
</el-button>
<el-button
:plain=
"true"
v-on:click
.native
=
"open6"
>
不会自动关闭的 Notification
</el-button>
</div>
```
html
<template>
<el-button
:plain=
"true"
v-on:click=
"open6"
>
不会自动关闭的 Notification
</el-button>
<el-button
:plain=
"true"
v-on:click
.native
=
"open6"
>
不会自动关闭的 Notification
</el-button>
</template>
<script>
...
...
@@ -179,12 +179,12 @@
## 回调函数
<div
class=
"demo-box demo-notification"
>
<el-button
:plain=
"true"
v-on:click=
"open7"
>
带有回调函数的 Notification
</el-button>
<el-button
:plain=
"true"
v-on:click
.native
=
"open7"
>
带有回调函数的 Notification
</el-button>
</div>
```
html
<template>
<el-button
:plain=
"true"
v-on:click=
"open7"
>
带有回调函数的 Notification
</el-button>
<el-button
:plain=
"true"
v-on:click
.native
=
"open7"
>
带有回调函数的 Notification
</el-button>
</template>
<script>
...
...
packages/alert/src/main.vue
View file @
5c90dbd2
<
template
>
<div
class=
"el-alert el-alert--
{{
type
}}
" transition="el-alert-fade" v-show="visible">
<i
class=
"el-alert__icon
{{
iconClass
}}
{{
isBigIcon
}}
" v-if="showIcon">
</i>
<div
class=
"el-alert__content"
>
<span
class=
"el-alert__title
{{
isBoldTitle
}}
" v-if="title">
{{
title
}}
</span>
<p
class=
"el-alert__description"
v-if=
"description"
>
{{
description
}}
</p>
<i
class=
"el-alert__closebtn"
:class=
"
{ 'is-customed': closeText !== '', 'el-icon-close': closeText === '' }" v-show="closable" @click="close()">
{{
closeText
}}
</i>
<transition
name=
"el-alert-fade"
>
<div
class=
"el-alert"
:class=
"[ typeClass ]"
v-show=
"visible"
>
<i
class=
"el-alert__icon"
:class=
"[ iconClass, isBigIcon ]"
v-if=
"showIcon"
></i>
<div
class=
"el-alert__content"
>
<span
class=
"el-alert__title"
:class=
"[ isBoldTitle ]"
v-if=
"title"
>
{{
title
}}
</span>
<p
class=
"el-alert__description"
v-if=
"description"
>
{{
description
}}
</p>
<i
class=
"el-alert__closebtn"
:class=
"
{ 'is-customed': closeText !== '', 'el-icon-close': closeText === '' }" v-show="closable" @click="close()">
{{
closeText
}}
</i>
</div>
</div>
</
div
>
</
transition
>
</
template
>
<
script
type=
"text/babel"
>
...
...
@@ -60,6 +62,10 @@
},
computed
:
{
typeClass
()
{
return
`el-alert--
${
this
.
type
}
`
;
},
iconClass
()
{
return
TYPE_CLASSES_MAP
[
this
.
type
]
||
'
el-icon-information
'
;
},
...
...
packages/message-box/package.json
View file @
5c90dbd2
...
...
@@ -12,6 +12,6 @@
"author"
:
"elemefe"
,
"license"
:
"MIT"
,
"dependencies"
:
{
"vue-popup"
:
"^0.
1.8
"
"vue-popup"
:
"^0.
2.1
"
}
}
packages/message-box/src/main.js
View file @
5c90dbd2
...
...
@@ -88,7 +88,7 @@ var showNextMsg = function() {
initInstance
();
}
if
(
!
instance
.
v
isibl
e
||
instance
.
closeTimer
)
{
if
(
!
instance
.
v
alu
e
||
instance
.
closeTimer
)
{
if
(
msgQueue
.
length
>
0
)
{
currentMsg
=
msgQueue
.
shift
();
...
...
@@ -98,10 +98,15 @@ var showNextMsg = function() {
instance
[
prop
]
=
options
[
prop
];
}
}
instance
.
$appendTo
(
document
.
body
);
[
'
modal
'
,
'
showClose
'
,
'
closeOnClickModal
'
,
'
closeOnPressEscape
'
].
forEach
(
prop
=>
{
if
(
instance
[
prop
]
===
undefined
)
{
instance
[
prop
]
=
true
;
}
});
document
.
body
.
appendChild
(
instance
.
$el
);
Vue
.
nextTick
(()
=>
{
instance
.
v
isibl
e
=
true
;
instance
.
v
alu
e
=
true
;
});
}
}
...
...
@@ -188,7 +193,7 @@ MessageBox.prompt = function(message, title, options) {
};
MessageBox
.
close
=
function
()
{
instance
.
v
isibl
e
=
false
;
instance
.
v
alu
e
=
false
;
msgQueue
=
[];
currentMsg
=
null
;
};
...
...
packages/message-box/src/main.vue
View file @
5c90dbd2
<
template
>
<div
class=
"el-message-box__wrapper"
>
<div
class=
"el-message-box"
v-if=
"rendered"
v-show=
"visible"
transition=
"msgbox-bounce"
>
<div
class=
"el-message-box__header"
v-if=
"title !== ''"
>
<div
class=
"el-message-box__title"
>
{{
title
}}
</div>
<i
class=
"el-message-box__close el-icon-close"
@
click=
"handleAction('cancel')"
v-if=
"showClose"
></i>
</div>
<div
class=
"el-message-box__content"
v-if=
"message !== ''"
>
<div
class=
"el-message-box__status
{{
typeClass
}}
">
</div>
<div
class=
"el-message-box__message"
:style=
"
{ 'margin-left': type ? '50px' : '0' }">
<p>
{{
message
}}
</p></div>
<div
class=
"el-message-box__input"
v-show=
"showInput"
>
<input
type=
"text"
v-model=
"inputValue"
:placeholder=
"inputPlaceholder"
v-el:input
/>
<div
class=
"el-message-box__errormsg"
:style=
"
{ visibility: !!editorErrorMessage ? 'visible' : 'hidden' }">
{{
editorErrorMessage
}}
</div>
<transition
name=
"msgbox-bounce"
>
<div
class=
"el-message-box"
v-show=
"value"
>
<div
class=
"el-message-box__header"
v-if=
"title !== ''"
>
<div
class=
"el-message-box__title"
>
{{
title
}}
</div>
<i
class=
"el-message-box__close el-icon-close"
@
click=
"handleAction('cancel')"
v-if=
"showClose"
></i>
</div>
<div
class=
"el-message-box__content"
v-if=
"message !== ''"
>
<div
class=
"el-message-box__status"
:class=
"[ typeClass ]"
></div>
<div
class=
"el-message-box__message"
:style=
"
{ 'margin-left': type ? '50px' : '0' }">
<p>
{{
message
}}
</p></div>
<div
class=
"el-message-box__input"
v-show=
"showInput"
>
<input
type=
"text"
v-model=
"inputValue"
:placeholder=
"inputPlaceholder"
ref=
"input"
/>
<div
class=
"el-message-box__errormsg"
:style=
"
{ visibility: !!editorErrorMessage ? 'visible' : 'hidden' }">
{{
editorErrorMessage
}}
</div>
</div>
</div>
<div
class=
"el-message-box__btns"
>
<el-button
:class=
"[ cancelButtonClasses ]"
v-show=
"showCancelButton"
@
click.native=
"handleAction('cancel')"
>
{{
cancelButtonText
}}
</el-button>
<el-button
:class=
"[ confirmButtonClasses ]"
v-show=
"showConfirmButton"
@
click.native=
"handleAction('confirm')"
type=
"primary"
>
{{
confirmButtonText
}}
</el-button>
</div>
</div>
<div
class=
"el-message-box__btns"
>
<el-button
class=
"
{{
cancelButtonClasses
}}
" v-show="showCancelButton" @click="handleAction('cancel')">
{{
cancelButtonText
}}
</el-button>
<el-button
class=
"
{{
confirmButtonClasses
}}
" v-show="showConfirmButton" @click="handleAction('confirm')" type="primary">
{{
confirmButtonText
}}
</el-button>
</div>
</div>
</transition>
</div>
</
template
>
...
...
@@ -34,8 +36,6 @@
import
Popup
from
'
vue-popup
'
;
export
default
{
name
:
'
el-message-box
'
,
mixins
:
[
Popup
],
props
:
{
...
...
@@ -68,12 +68,27 @@
},
methods
:
{
doClose
()
{
this
.
value
=
false
;
this
.
_closing
=
true
;
this
.
onClose
&&
this
.
onClose
();
if
(
this
.
modal
)
{
document
.
body
.
style
.
overflow
=
this
.
bodyOverflow
;
}
if
(
!
this
.
transition
)
{
this
.
doAfterClose
();
}
},
handleAction
(
action
)
{
if
(
this
.
$type
===
'
prompt
'
&&
action
===
'
confirm
'
&&
!
this
.
validate
())
{
return
;
}
var
callback
=
this
.
callback
;
this
.
v
isibl
e
=
false
;
this
.
v
alu
e
=
false
;
callback
(
action
);
},
...
...
@@ -109,11 +124,11 @@
}
},
v
isibl
e
(
val
)
{
v
alu
e
(
val
)
{
if
(
val
&&
this
.
$type
===
'
prompt
'
)
{
setTimeout
(()
=>
{
if
(
this
.
$
el
s
.
input
)
{
this
.
$
el
s
.
input
.
focus
();
if
(
this
.
$
ref
s
.
input
)
{
this
.
$
ref
s
.
input
.
focus
();
}
},
500
);
}
...
...
packages/notification/src/main.js
View file @
5c90dbd2
...
...
@@ -19,7 +19,8 @@ var Notification = function(options) {
});
instance
.
id
=
id
;
instance
.
vm
=
instance
.
$mount
();
instance
.
vm
.
$appendTo
(
'
body
'
);
document
.
body
.
appendChild
(
instance
.
vm
.
$el
);
instance
.
vm
.
visible
=
true
;
instance
.
dom
=
instance
.
vm
.
$el
;
var
topDist
=
0
;
...
...
@@ -46,7 +47,7 @@ Notification.close = function(id, userOnClose) {
if
(
len
>
1
)
{
for
(
i
=
index
;
i
<
len
-
1
;
i
++
)
{
instances
[
i
].
dom
.
style
.
top
=
parseInt
(
instances
[
i
].
dom
.
style
.
top
,
10
)
-
removedHeight
-
1
0
+
'
px
'
;
instances
[
i
].
dom
.
style
.
top
=
parseInt
(
instances
[
i
].
dom
.
style
.
top
,
10
)
-
removedHeight
-
1
6
+
'
px
'
;
}
}
};
...
...
packages/notification/src/main.vue
View file @
5c90dbd2
<
template
>
<div
class=
"el-notification"
transition=
"el-notification-fade"
:style=
"
{ top: top ? top + 'px' : 'auto' }" @mouseenter="clearTimer()" @mouseleave="startTimer()">
<i
class=
"el-notification__icon el-icon-
{{
typeClass
}}
" v-if="type">
</i>
<div
class=
"el-notification__group"
:style=
"
{ 'margin-left': type ? '55px' : '0' }">
<span>
{{
title
}}
</span>
<p>
{{
message
}}
</p>
<div
class=
"el-notification__closeBtn el-icon-close"
@
click=
"handleClose()"
></div>
<transition
name=
"el-notification-fade"
>
<div
class=
"el-notification"
v-show=
"visible"
:style=
"
{ top: top ? top + 'px' : 'auto' }" @mouseenter="clearTimer()" @mouseleave="startTimer()">
<i
class=
"el-notification__icon"
:class=
"[ typeClass ]"
v-if=
"type"
></i>
<div
class=
"el-notification__group"
:style=
"
{ 'margin-left': type ? '55px' : '0' }">
<span>
{{
title
}}
</span>
<p>
{{
message
}}
</p>
<div
class=
"el-notification__closeBtn el-icon-close"
@
click=
"handleClose()"
></div>
</div>
</div>
</
div
>
</
transition
>
</
template
>
<
script
type=
"text/babel"
>
...
...
@@ -18,10 +20,9 @@
};
export
default
{
name
:
'
ElNotification
'
,
data
()
{
return
{
visible
:
false
,
title
:
''
,
message
:
''
,
duration
:
4500
,
...
...
@@ -36,14 +37,18 @@
computed
:
{
typeClass
()
{
return
this
.
type
?
typeMap
[
this
.
type
]
:
''
;
return
this
.
type
?
`el-icon-
${
typeMap
[
this
.
type
]
}
`
:
''
;
}
},
watch
:
{
closed
(
newVal
)
{
if
(
newVal
)
{
this
.
$destroy
(
true
);
this
.
visible
=
false
;
this
.
$el
.
addEventListener
(
'
transitionend
'
,
()
=>
{
this
.
$destroy
(
true
);
this
.
$el
.
parentNode
.
removeChild
(
this
.
$el
);
});
}
}
},
...
...
@@ -71,7 +76,7 @@
}
},
ready
()
{
mounted
()
{
if
(
this
.
duration
>
0
)
{
this
.
timer
=
setTimeout
(()
=>
{
if
(
!
this
.
closed
)
{
...
...
packages/theme-default/src/alert.css
View file @
5c90dbd2
...
...
@@ -15,6 +15,7 @@
color
:
#fff
;
opacity
:
1
;
display
:
table
;
transition
:
opacity
.2s
;
@modifier
success
{
background-color
:
#13ce66
;
...
...
@@ -78,12 +79,8 @@
}
}
.el-alert-fade-transition
{
transition
:
opacity
.2s
;
}
.el-alert-fade-enter
,
.el-alert-fade-leave
{
.el-alert-fade-leave
-active
{
opacity
:
0
;
}
}
packages/theme-default/src/message-box.css
View file @
5c90dbd2
...
...
@@ -115,12 +115,12 @@
}
}
.msgbox-bounce-enter
{
.msgbox-bounce-enter
-active
{
-webkit-animation
:
msgbox-bounce-in
.3s
cubic-bezier
(
0.3
,
0
,
0
,
1.5
);
animation
:
msgbox-bounce-in
.3s
cubic-bezier
(
0.3
,
0
,
0
,
1.5
);
}
.msgbox-bounce-leave
{
.msgbox-bounce-leave
-active
{
-webkit-animation
:
msgbox-bounce-out
.2s
cubic-bezier
(
0.895
,
0.03
,
0.685
,
0.22
);
animation
:
msgbox-bounce-out
.2s
cubic-bezier
(
0.895
,
0.03
,
0.685
,
0.22
);
}
...
...
packages/theme-default/src/notification.css
View file @
5c90dbd2
...
...
@@ -72,7 +72,7 @@
right
:
0
;
}
.el-notification-fade-leave
{
.el-notification-fade-leave
-active
{
opacity
:
0
;
}
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment