Skip to content

Card

Display content in a card block.

Basic Usage

The header can enable a highlight tip. If no header is needed, omit the header slot. You can enable head-tip to highlight the front of the header.

card名称
cardContent
cardContent
cardContent
cardContent
<template>
  <b-card class="box-card" width="480px" head-tip>
    <template #header>
      <div flex="main:justify cross:center">
        <span>card名称</span>
        <b-icon name="dropbox" size="20" style="cursor: pointer"></b-icon>
      </div>
    </template>
    <div v-for="o in 4" :key="o" class="text item">cardContent</div>
  </b-card>
</template>

Default Title and Divider

Passing a header directly generates a default title; set divider="no" to remove the divider between the default title and content.

cardTitle
这是Content区域 1
这是Content区域 2
这是Content区域 3
这是Content区域 4
cardTitle
这是Content区域 1
这是Content区域 2
这是Content区域 3
这是Content区域 4
<template>
  <div style="background: #f8f8f8; padding: 20px">
    <div flex="main:justify box:mean">
      <div style="padding: 0 10px">
        <b-card class="box-card" header="cardTitle">
          <div v-for="o in 4" :key="o" class="text item">
            {{ '这是Content区域 ' + o }}
          </div>
        </b-card>
      </div>
      <div style="padding: 0 10px">
        <b-card class="box-card" header="cardTitle" divider="no">
          <div v-for="o in 4" :key="o" class="text item">
            {{ '这是Content区域 ' + o }}
          </div>
        </b-card>
      </div>
    </div>
  </div>
</template>

Border and Border Radius

No border is suitable when used with a background.

cardTitle
bordered controls whether to show a border
cardTitle
radius sets the border radius value
<template>
  <div style="background: #f8f8f8; padding: 20px">
    <div flex="main:justify box:mean">
      <div style="padding: 0 10px">
        <b-card class="box-card" header="cardTitle" :bordered="false">
          <div>bordered controls whether to show a border</div>
        </b-card>
      </div>
      <div style="padding: 0 10px">
        <b-card class="box-card" header="cardTitle" radius="10px">
          <div>radius sets the border radius value</div>
        </b-card>
      </div>
    </div>
  </div>
</template>

shadow

总是show
Defaulthovershow
不show
<template>
  <div flex="main:justify box:mean">
    <div style="padding: 0 10px">
      <b-card class="box-card" shadow="always">
        <div>总是show</div>
      </b-card>
    </div>
    <div style="padding: 0 10px">
      <b-card class="box-card">
        <div>Defaulthovershow</div>
      </b-card>
    </div>
    <div style="padding: 0 10px">
      <b-card class="box-card" shadow="never">
        <div>不show</div>
      </b-card>
    </div>
  </div>
</template>

Props

ParameterDescriptionTypeOptionsDefault
headerSet header, can also be inserted via slotString
body-styleSet body stylesObject
shadowShadow displayStringalways / hover / neverhover
borderedWhether to show borderBooleanfalsetrue
widthSet default card widthString100%
radiusSet border radius valueString0 / percentage / px4px
dividerDivider between header and bodyStringno / hashas
head-tipHighlight tip for headerBooleantrue / falsefalse
bg-colorOverall background colorString#fff