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
d54bf670
Commit
d54bf670
authored
Nov 16, 2016
by
SkyAo
Committed by
GitHub
Nov 16, 2016
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #1099 from QingWei-Li/feat/popover-manual
Popover: add manual
parents
9f9fd8f7
602c5699
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
19 additions
and
5 deletions
+19
-5
examples/docs/en-US/popover.md
examples/docs/en-US/popover.md
+2
-2
examples/docs/zh-CN/popover.md
examples/docs/zh-CN/popover.md
+1
-1
packages/popover/src/main.vue
packages/popover/src/main.vue
+2
-2
test/unit/specs/popover.spec.js
test/unit/specs/popover.spec.js
+14
-0
No files found.
examples/docs/en-US/popover.md
View file @
d54bf670
...
@@ -125,7 +125,7 @@ Similar to Tooltip, Popover is also built with `Vue-popper`. So for some duplica
...
@@ -125,7 +125,7 @@ Similar to Tooltip, Popover is also built with `Vue-popper`. So for some duplica
### Nested information
### Nested information
Other components can be nested in popover. Following is an example of nested table.
Other components can be nested in popover. Following is an example of nested table.
:::demo replace the
`content`
attribute with a default
`slot`
.
:::demo replace the
`content`
attribute with a default
`slot`
.
...
@@ -207,7 +207,7 @@ Of course, you can nest other operations. It's more light-weight than using a di
...
@@ -207,7 +207,7 @@ Of course, you can nest other operations. It's more light-weight than using a di
### Attributes
### Attributes
| Attribute | Description | Type | Accepted Values | Default |
| Attribute | Description | Type | Accepted Values | Default |
|--------------------|----------------------------------------------------------|-------------------|-------------|--------|
|--------------------|----------------------------------------------------------|-------------------|-------------|--------|
| trigger | how the popover is triggered | string | click/focus/hover | click |
| trigger | how the popover is triggered | string | click/focus/hover
/manual
| click |
| title | popover title | string | — | — |
| title | popover title | string | — | — |
| content | popover content, can be replaced with a default
`slot`
| string | — | — |
| content | popover content, can be replaced with a default
`slot`
| string | — | — |
| width | popover width | string, number | — | Min width 150px |
| width | popover width | string, number | — | Min width 150px |
...
...
examples/docs/zh-CN/popover.md
View file @
d54bf670
...
@@ -234,7 +234,7 @@ Popover 的属性与 Tooltip 很类似,它们都是基于`Vue-popper`开发的
...
@@ -234,7 +234,7 @@ Popover 的属性与 Tooltip 很类似,它们都是基于`Vue-popper`开发的
### Attributes
### Attributes
| 参数 | 说明 | 类型 | 可选值 | 默认值 |
| 参数 | 说明 | 类型 | 可选值 | 默认值 |
|--------------------|----------------------------------------------------------|-------------------|-------------|--------|
|--------------------|----------------------------------------------------------|-------------------|-------------|--------|
| trigger | 触发方式 | String | click/focus/hover | click |
| trigger | 触发方式 | String | click/focus/hover
/manual
| click |
| title | 标题 | String | — | — |
| title | 标题 | String | — | — |
| content | 显示的内容,也可以通过
`slot`
传入 DOM | String | — | — |
| content | 显示的内容,也可以通过
`slot`
传入 DOM | String | — | — |
| width | 宽度 | String, Number | — | 最小宽度 150px |
| width | 宽度 | String, Number | — | 最小宽度 150px |
...
...
packages/popover/src/main.vue
View file @
d54bf670
...
@@ -28,7 +28,7 @@ export default {
...
@@ -28,7 +28,7 @@ export default {
trigger
:
{
trigger
:
{
type
:
String
,
type
:
String
,
default
:
'
click
'
,
default
:
'
click
'
,
validator
:
value
=>
[
'
click
'
,
'
focus
'
,
'
hover
'
].
indexOf
(
value
)
>
-
1
validator
:
value
=>
[
'
click
'
,
'
focus
'
,
'
hover
'
,
'
manual
'
].
indexOf
(
value
)
>
-
1
},
},
title
:
String
,
title
:
String
,
content
:
String
,
content
:
String
,
...
@@ -67,7 +67,7 @@ export default {
...
@@ -67,7 +67,7 @@ export default {
on
(
popper
,
'
mouseenter
'
,
this
.
handleMouseEnter
);
on
(
popper
,
'
mouseenter
'
,
this
.
handleMouseEnter
);
on
(
reference
,
'
mouseleave
'
,
this
.
handleMouseLeave
);
on
(
reference
,
'
mouseleave
'
,
this
.
handleMouseLeave
);
on
(
popper
,
'
mouseleave
'
,
this
.
handleMouseLeave
);
on
(
popper
,
'
mouseleave
'
,
this
.
handleMouseLeave
);
}
else
{
}
else
if
(
this
.
trigger
===
'
focus
'
)
{
let
found
=
false
;
let
found
=
false
;
if
([].
slice
.
call
(
reference
.
children
).
length
)
{
if
([].
slice
.
call
(
reference
.
children
).
length
)
{
...
...
test/unit/specs/popover.spec.js
View file @
d54bf670
...
@@ -45,6 +45,20 @@ describe('Popover', () => {
...
@@ -45,6 +45,20 @@ describe('Popover', () => {
},
250
);
// 代码里是 200ms
},
250
);
// 代码里是 200ms
});
});
it
(
'
manual
'
,
done
=>
{
vm
=
createVM
(
'
manual
'
);
const
compo
=
vm
.
$refs
.
popover
;
const
button
=
vm
.
$el
.
querySelector
(
'
button
'
);
triggerEvent
(
button
,
'
mouseenter
'
);
expect
(
compo
.
showPopper
).
to
.
false
;
triggerEvent
(
button
,
'
mouseleave
'
);
setTimeout
(
_
=>
{
expect
(
compo
.
showPopper
).
to
.
false
;
done
();
},
250
);
// 代码里是 200ms
});
it
(
'
focus input in children node
'
,
()
=>
{
it
(
'
focus input in children node
'
,
()
=>
{
vm
=
createVue
(
`
vm
=
createVue
(
`
<div>
<div>
...
...
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