W3Cschool
恭喜您成為首批注冊(cè)用戶
獲得88經(jīng)驗(yàn)值獎(jiǎng)勵(lì)
出現(xiàn)在按鈕、圖標(biāo)旁的數(shù)字或狀態(tài)標(biāo)記。
展示新消息數(shù)量。
定義value屬性,它接受Number或者String。
<template>
<el-badge :value="12" class="item">
<el-button size="small">評(píng)論</el-button>
</el-badge>
<el-badge :value="3" class="item">
<el-button size="small">回復(fù)</el-button>
</el-badge>
<el-badge :value="1" class="item" type="primary">
<el-button size="small">評(píng)論</el-button>
</el-badge>
<el-badge :value="2" class="item" type="warning">
<el-button size="small">回復(fù)</el-button>
</el-badge>
<el-dropdown trigger="click">
<span class="el-dropdown-link">
點(diǎn)我查看<i class="el-icon-caret-bottom el-icon--right"></i>
</span>
<template #dropdown>
<el-dropdown-menu>
<el-dropdown-item class="clearfix">
評(píng)論
<el-badge class="mark" :value="12" />
</el-dropdown-item>
<el-dropdown-item class="clearfix">
回復(fù)
<el-badge class="mark" :value="3" />
</el-dropdown-item>
</el-dropdown-menu>
</template>
</el-dropdown>
</template>
<style>
.item {
margin-top: 10px;
margin-right: 40px;
}
</style>
可自定義最大值。
由max屬性定義,它接受一個(gè)Number,需要注意的是,只有當(dāng)value為Number時(shí),它才會(huì)生效。
<template>
<el-badge :value="200" :max="99" class="item">
<el-button size="small">評(píng)論</el-button>
</el-badge>
<el-badge :value="100" :max="10" class="item">
<el-button size="small">回復(fù)</el-button>
</el-badge>
</template>
<style>
.item {
margin-top: 10px;
margin-right: 40px;
}
</style>
可以顯示數(shù)字以外的文本內(nèi)容。
定義value為String類型是時(shí)可以用于顯示自定義文本。
<template>
<el-badge value="new" class="item">
<el-button size="small">評(píng)論</el-button>
</el-badge>
<el-badge value="hot" class="item">
<el-button size="small">回復(fù)</el-button>
</el-badge>
</template>
<style>
.item {
margin-top: 10px;
margin-right: 40px;
}
</style>
以紅點(diǎn)的形式標(biāo)注需要關(guān)注的內(nèi)容。
除了數(shù)字外,設(shè)置is-dot屬性,它接受一個(gè)Boolean。
<template>
<el-badge is-dot class="item">數(shù)據(jù)查詢</el-badge>
<el-badge is-dot class="item">
<el-button
class="share-button"
icon="el-icon-share"
type="primary"
></el-button>
</el-badge>
</template>
<style>
.item {
margin-top: 10px;
margin-right: 40px;
}
</style>
參數(shù) | 說明 | 類型 | 可選值 | 默認(rèn)值 |
---|---|---|---|---|
value | 顯示值 | string, number | — | — |
max | 最大值,超過最大值會(huì)顯示 '{max}+',要求 value 是 Number 類型 | number | — | — |
is-dot | 小圓點(diǎn) | boolean | — | false |
hidden | 隱藏 badge | boolean | — | false |
type | 類型 | string | primary / success / warning / danger / info | — |
Copyright©2021 w3cschool編程獅|閩ICP備15016281號(hào)-3|閩公網(wǎng)安備35020302033924號(hào)
違法和不良信息舉報(bào)電話:173-0602-2364|舉報(bào)郵箱:jubao@eeedong.com
掃描二維碼
下載編程獅App
編程獅公眾號(hào)
聯(lián)系方式:
更多建議: