forked from ElemeFE/element
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
PageHeader: add page-header component (ElemeFE#15714)
- Loading branch information
Showing
64 changed files
with
446 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
## PageHeader | ||
|
||
If path of the page is simple, it is recommended to use PageHeader instead of the Breadcrumb. | ||
|
||
### Basic | ||
|
||
:::demo | ||
```html | ||
<el-page-header @back="goBack" content="detail"> | ||
</el-page-header> | ||
|
||
<script> | ||
export default { | ||
methods: { | ||
goBack() { | ||
console.log('go back'); | ||
} | ||
} | ||
} | ||
</script> | ||
```html | ||
::: | ||
|
||
### Attributes | ||
| Attribute | Description | Type | Accepted Values | Default | | ||
|---------- |-------------- |---------- |------------------------------ | ------ | | ||
| title | main title | string | — | Back | | ||
| content | content | string | — | — | | ||
|
||
### Events | ||
| Event Name | Description | Parameters | | ||
|----------- |-------------- |----------- | | ||
| back | triggers when right side is clicked | — | | ||
|
||
### Slots | ||
| slot | Description | | ||
|---------- | ---------------------- | | ||
| title | title content | | ||
| content | content | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
## PageHeader | ||
|
||
If path of the page is simple, it is recommended to use PageHeader instead of the Breadcrumb. | ||
|
||
### Basic | ||
|
||
:::demo | ||
```html | ||
<el-page-header @back="goBack" content="detail"> | ||
</el-page-header> | ||
|
||
<script> | ||
export default { | ||
methods: { | ||
goBack() { | ||
console.log('go back'); | ||
} | ||
} | ||
} | ||
</script> | ||
```html | ||
::: | ||
|
||
### Attributes | ||
| Attribute | Description | Type | Accepted Values | Default | | ||
|---------- |-------------- |---------- |------------------------------ | ------ | | ||
| title | main title | string | — | Back | | ||
| content | content | string | — | — | | ||
|
||
### Events | ||
| Event Name | Description | Parameters | | ||
|----------- |-------------- |----------- | | ||
| back | triggers when right side is clicked | — | | ||
|
||
### Slots | ||
| slot | Description | | ||
|---------- | ---------------------- | | ||
| title | title content | | ||
| content | content | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
## PageHeader | ||
|
||
If path of the page is simple, it is recommended to use PageHeader instead of the Breadcrumb. | ||
|
||
### Basic | ||
|
||
:::demo | ||
```html | ||
<el-page-header @back="goBack" content="detail"> | ||
</el-page-header> | ||
|
||
<script> | ||
export default { | ||
methods: { | ||
goBack() { | ||
console.log('go back'); | ||
} | ||
} | ||
} | ||
</script> | ||
```html | ||
::: | ||
|
||
### Attributes | ||
| Attribute | Description | Type | Accepted Values | Default | | ||
|---------- |-------------- |---------- |------------------------------ | ------ | | ||
| title | main title | string | — | Back | | ||
| content | content | string | — | — | | ||
|
||
### Events | ||
| Event Name | Description | Parameters | | ||
|----------- |-------------- |----------- | | ||
| back | triggers when right side is clicked | — | | ||
|
||
### Slots | ||
| slot | Description | | ||
|---------- | ---------------------- | | ||
| title | title content | | ||
| content | content | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
## PageHeader 页头 | ||
|
||
如果页面的路径比较简单,推荐使用页头组件而非面包屑组件。 | ||
|
||
### 基础 | ||
|
||
:::demo | ||
```html | ||
<el-page-header @back="goBack" content="详情页面"> | ||
</el-page-header> | ||
|
||
<script> | ||
export default { | ||
methods: { | ||
goBack() { | ||
console.log('go back'); | ||
} | ||
} | ||
} | ||
</script> | ||
``` | ||
::: | ||
|
||
### Attributes | ||
| 参数 | 说明 | 类型 | 可选值 | 默认值 | | ||
|---------- |-------------- |---------- |------------------------------ | ------ | | ||
| title | 标题 | string | — | 返回 | | ||
| content | 内容 | string | — | — | | ||
|
||
|
||
### Events | ||
| 事件名称 | 说明 | 回调参数 | | ||
|---------- |-------------- |---------- | | ||
| back | 点击左侧区域触发 | — | | ||
|
||
### Slots | ||
| 事件名称 | 说明 | | ||
|---------- |------------- | | ||
| title | 标题内容 | | ||
| content | 内容 | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
import PageHeader from './src/main'; | ||
|
||
/* istanbul ignore next */ | ||
PageHeader.install = function(Vue) { | ||
Vue.component(PageHeader.name, PageHeader); | ||
}; | ||
|
||
export default PageHeader; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
<template> | ||
<div class="el-page-header"> | ||
<div class="el-page-header__left" @click="$emit('back')"> | ||
<i class="el-icon-back"></i> | ||
<div class="el-page-header__title"> | ||
<slot name="title">{{ title }}</slot> | ||
</div> | ||
</div> | ||
<div class="el-page-header__content"> | ||
<slot name="content">{{ content }}</slot> | ||
</div> | ||
</div> | ||
</template> | ||
|
||
<script> | ||
import { t } from 'element-ui/src/locale'; | ||
export default { | ||
name: 'ElPageHeader', | ||
props: { | ||
title: { | ||
type: String, | ||
default() { | ||
return t('el.pageHeader.title'); | ||
} | ||
}, | ||
content: String | ||
} | ||
}; | ||
</script> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -72,3 +72,4 @@ | |
@import "./image.scss"; | ||
@import "./calendar.scss"; | ||
@import "./backtop.scss"; | ||
@import "./page-header.scss"; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
@import "mixins/mixins"; | ||
@import "common/var"; | ||
|
||
@include b(page-header) { | ||
display: flex; | ||
line-height: 24px; | ||
|
||
@include e(left) { | ||
display: flex; | ||
cursor: pointer; | ||
margin-right: 40px; | ||
position: relative; | ||
|
||
&::after { | ||
content: ""; | ||
position: absolute; | ||
width: 1px; | ||
height: 16px; | ||
right: -20px; | ||
top: 50%; | ||
transform: translateY(-50%); | ||
background-color: $--border-color-base; | ||
} | ||
|
||
.el-icon-back { | ||
font-size: 18px; | ||
margin-right: 6px; | ||
align-self: center; | ||
} | ||
|
||
@include e(title) { | ||
font-size: 14px; | ||
font-weight: 500; | ||
} | ||
} | ||
|
||
@include e(content) { | ||
font-size: 18px; | ||
color: $--color-text-primary; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.