Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feat: Badge add some new features. #22894

Open
wants to merge 1 commit into
base: dev
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
95 changes: 66 additions & 29 deletions examples/docs/en-US/badge.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,35 +9,62 @@ Displays the amount of new messages.
:::demo The amount is defined with `value` which accepts `Number` or `String`.

```html
<el-badge :value="12" class="item">
<el-button size="small">comments</el-button>
</el-badge>
<el-badge :value="3" class="item">
<el-button size="small">replies</el-button>
</el-badge>
<el-badge :value="1" class="item" type="primary">
<el-button size="small">comments</el-button>
</el-badge>
<el-badge :value="2" class="item" type="warning">
<el-button size="small">replies</el-button>
</el-badge>

<el-dropdown trigger="click">
<span class="el-dropdown-link">
Click Me<i class="el-icon-caret-bottom el-icon--right"></i>
</span>
<el-dropdown-menu slot="dropdown">
<el-dropdown-item class="clearfix">
comments
<el-badge class="mark" :value="12" />
</el-dropdown-item>
<el-dropdown-item class="clearfix">
replies
<el-badge class="mark" :value="3" />
</el-dropdown-item>
</el-dropdown-menu>
</el-dropdown>

<template>
<div>
<div>
<el-badge :value="12" class="item">
<el-button size="small">comments</el-button>
</el-badge>
<el-badge :value="3" class="item">
<el-button size="small">replies</el-button>
</el-badge>
<el-badge :value="1" class="item" type="primary">
<el-button size="small">comments</el-button>
</el-badge>
<el-badge :value="2" class="item" type="warning">
<el-button size="small">replies</el-button>
</el-badge>
<el-dropdown trigger="click" class="item">
<span class="el-dropdown-link">
Click Me<i class="el-icon-caret-bottom el-icon--right"></i>
</span>
<el-dropdown-menu slot="dropdown">
<el-dropdown-item class="clearfix">
comments
<el-badge class="mark" :value="12" />
</el-dropdown-item>
<el-dropdown-item class="clearfix">
replies
<el-badge class="mark" :value="3" />
</el-dropdown-item>
</el-dropdown-menu>
</el-dropdown>
</div>
<div style="margin-top: 20px">
<el-badge :value="0" :show-zero="show" class="item">
<el-button size="small" @click="show = !show">show-zero: {{ show }}</el-button>
</el-badge>
<el-badge :value="2" class="item" background-color="#8C18FF">
<el-button size="small">background-color</el-button>
</el-badge>
<el-badge :value="1" :badge-style="{'color':'#000'}" class="item" type="primary">
<el-button size="small">badge-style</el-button>
</el-badge>
<el-badge :value="3" :offset="[10, 10]" class="item">
<el-button size="small">offset</el-button>
</el-badge>
</div>
</div>
</template>
<script>
export default {
data() {
return {
show: false
};
}
};
</script>
<style>
.item {
margin-top: 10px;
Expand Down Expand Up @@ -122,3 +149,13 @@ Use a red dot to mark content that needs to be noticed.
| is-dot | if a little dot is displayed | boolean | — | false |
| hidden | hidden badge | boolean | — | false |
| type | button type | string | primary / success / warning / danger / info | — |
| show-zero | Whether to show badge when value is zero. | boolean | — | true |
| background-color | background color of the dot | string | — | — |
| offset | offset of badge | [ left:number, top:number ] | — | — |
| badge-style | custom style of badge | object | — | — |
| badge-class | custom class of badge | string | — | — |

### Badge Slot
| Name | Description |
|------|--------|
| default | customize default content |
95 changes: 66 additions & 29 deletions examples/docs/es/badge.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,35 +9,62 @@ Muestra la cantidad de mensajes nuevos.
:::demo La cantidad está definida por `value` que acepta `Number` o `String`.

```html
<el-badge :value="12" class="item">
<el-button size="small">comments</el-button>
</el-badge>
<el-badge :value="3" class="item">
<el-button size="small">replies</el-button>
</el-badge>
<el-badge :value="1" class="item" type="primary">
<el-button size="small">comments</el-button>
</el-badge>
<el-badge :value="2" class="item" type="warning">
<el-button size="small">replies</el-button>
</el-badge>

<el-dropdown trigger="click">
<span class="el-dropdown-link">
Click Me<i class="el-icon-caret-bottom el-icon--right"></i>
</span>
<el-dropdown-menu slot="dropdown">
<el-dropdown-item class="clearfix">
comments
<el-badge class="mark" :value="12" />
</el-dropdown-item>
<el-dropdown-item class="clearfix">
replies
<el-badge class="mark" :value="3" />
</el-dropdown-item>
</el-dropdown-menu>
</el-dropdown>

<template>
<div>
<div>
<el-badge :value="12" class="item">
<el-button size="small">comments</el-button>
</el-badge>
<el-badge :value="3" class="item">
<el-button size="small">replies</el-button>
</el-badge>
<el-badge :value="1" class="item" type="primary">
<el-button size="small">comments</el-button>
</el-badge>
<el-badge :value="2" class="item" type="warning">
<el-button size="small">replies</el-button>
</el-badge>
<el-dropdown trigger="click" class="item">
<span class="el-dropdown-link">
Click Me<i class="el-icon-caret-bottom el-icon--right"></i>
</span>
<el-dropdown-menu slot="dropdown">
<el-dropdown-item class="clearfix">
comments
<el-badge class="mark" :value="12" />
</el-dropdown-item>
<el-dropdown-item class="clearfix">
replies
<el-badge class="mark" :value="3" />
</el-dropdown-item>
</el-dropdown-menu>
</el-dropdown>
</div>
<div style="margin-top: 20px">
<el-badge :value="0" :show-zero="show" class="item">
<el-button size="small" @click="show = !show">show-zero: {{ show }}</el-button>
</el-badge>
<el-badge :value="2" class="item" background-color="#8C18FF">
<el-button size="small">background-color</el-button>
</el-badge>
<el-badge :value="1" :badge-style="{'color':'#000'}" class="item" type="primary">
<el-button size="small">badge-style</el-button>
</el-badge>
<el-badge :value="3" :offset="[10, 10]" class="item">
<el-button size="small">offset</el-button>
</el-badge>
</div>
</div>
</template>
<script>
export default {
data() {
return {
show: false
};
}
};
</script>
<style>
.item {
margin-top: 10px;
Expand Down Expand Up @@ -122,4 +149,14 @@ Puede utilizar un punto rojo para marcar contenido que debe ser notado.
| is-dot | si se debe mostrar un pequeño punto | boolean | — | false |
| hidden | oculta el badge | boolean | — | false |
| type | tipo de botón | string | primary / success / warning / danger / info | — |
| show-zero | Si se muestra la insignia a las 00: 00. | boolean | — | true |
| background-color | Color de fondo del punto | string | — | — |
| offset | Desviación de la insignia | [ left:number, top:number ] | — | — |
| badge-style | Estilo personalizado de la insignia | object | — | — |
| badge-class | Categoría personalizada de la insignia | string | — | — |

### Badge Slot
| Name | Description |
|------|--------|
| default | Personalizar el contenido predeterminado |

95 changes: 66 additions & 29 deletions examples/docs/fr-FR/badge.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,35 +9,62 @@ Affiche le nombre de nouveaux messages.
:::demo La quantité est définit par `value` qui accepte un `Number` ou un `String`.

```html
<el-badge :value="12" class="item">
<el-button size="small">Commentaires</el-button>
</el-badge>
<el-badge :value="3" class="item">
<el-button size="small">Réponses</el-button>
</el-badge>
<el-badge :value="1" class="item" type="primary">
<el-button size="small">Commentaires</el-button>
</el-badge>
<el-badge :value="2" class="item" type="warning">
<el-button size="small">Réponses</el-button>
</el-badge>

<el-dropdown trigger="click">
<span class="el-dropdown-link">
Cliquez<i class="el-icon-caret-bottom el-icon--right"></i>
</span>
<el-dropdown-menu slot="dropdown">
<el-dropdown-item class="clearfix">
Commentaires
<el-badge class="mark" :value="12" />
</el-dropdown-item>
<el-dropdown-item class="clearfix">
Réponses
<el-badge class="mark" :value="3" />
</el-dropdown-item>
</el-dropdown-menu>
</el-dropdown>

<template>
<div>
<div>
<el-badge :value="12" class="item">
<el-button size="small">Commentaires</el-button>
</el-badge>
<el-badge :value="3" class="item">
<el-button size="small">Réponses</el-button>
</el-badge>
<el-badge :value="1" class="item" type="primary">
<el-button size="small">Commentaires</el-button>
</el-badge>
<el-badge :value="2" class="item" type="warning">
<el-button size="small">Réponses</el-button>
</el-badge>
<el-dropdown trigger="click" class="item">
<span class="el-dropdown-link">
Cliquez<i class="el-icon-caret-bottom el-icon--right"></i>
</span>
<el-dropdown-menu slot="dropdown">
<el-dropdown-item class="clearfix">
Commentaires
<el-badge class="mark" :value="12" />
</el-dropdown-item>
<el-dropdown-item class="clearfix">
Réponses
<el-badge class="mark" :value="3" />
</el-dropdown-item>
</el-dropdown-menu>
</el-dropdown>
</div>
<div style="margin-top: 20px">
<el-badge :value="0" :show-zero="show" class="item">
<el-button size="small" @click="show = !show">show-zero: {{ show }}</el-button>
</el-badge>
<el-badge :value="2" class="item" background-color="#8C18FF">
<el-button size="small">background-color</el-button>
</el-badge>
<el-badge :value="1" :badge-style="{'color':'#000'}" class="item" type="primary">
<el-button size="small">badge-style</el-button>
</el-badge>
<el-badge :value="3" :offset="[10, 10]" class="item">
<el-button size="small">offset</el-button>
</el-badge>
</div>
</div>
</template>
<script>
export default {
data() {
return {
show: false
};
}
};
</script>
<style>
.item {
margin-top: 10px;
Expand Down Expand Up @@ -123,3 +150,13 @@ Utilisez un point rouge pour signaler du contenu devant être remarqué.
| is-dot | Affiche un point rouge. | boolean | — | false |
| hidden | Cache le badge. | boolean | — | false |
| type | Type du bouton. | string | primary / success / warning / danger / info | — |
| show-zero | Si le badge est affiché lorsque la valeur est zéro. | boolean | — | true |
| background-color | Couleur de fond des points | string | — | — |
| offset | Décalage de badge | [ left:number, top:number ] | — | — |
| badge-style | Styles personnalisés de badges | object | — | — |
| badge-class | Catégories personnalisées de badges | string | — | — |

### Badge Slot
| Name | Description |
|------|--------|
| default | Personnaliser le contenu par défaut |
Loading
Loading