Skip to content
On this page

调整主题

通过使用 b-config-provider 调整主题。

默认情况下所有组件均为亮色主题,无需任何配置。

了解更多关于b-config-provider 的信息,参见 全局化配置 [TODO]

调整主题变量

你不需要写任何 CSS(Scss、Less、Stylus...)。

配置的全局主题变量会对后代组件生效的主题变量覆盖。

[default]默认按钮
[plain]简约按钮
[round]圆角按钮
[dashed]虚线按钮
<template>
  <b-config-provider
    :theme="{
      binColorPrimary: '#722ed1',
      binColorSuccess: '#13c2c2',
      binColorWarning: '#e14c19',
      binColorDanger: '#d42a87'
    }"
  >
    <div>
      <div>[default]默认按钮</div>
      <div class="demo-button">
        <b-button type="primary">Primary</b-button>
        <b-button type="success">Success</b-button>
        <b-button type="warning">Warning</b-button>
        <b-button type="danger">Danger</b-button>
      </div>
      <div>[plain]简约按钮</div>
      <div class="demo-button">
        <b-button type="primary" plain>Primary</b-button>
        <b-button type="success" plain>Success</b-button>
        <b-button type="warning" plain>Warning</b-button>
        <b-button type="danger" plain>Danger</b-button>
      </div>
      <div>[round]圆角按钮</div>
      <div class="demo-button">
        <b-button type="primary" round>Primary</b-button>
        <b-button type="success" round>Success</b-button>
        <b-button type="warning" round>Warning</b-button>
        <b-button type="danger" round>Danger</b-button>
      </div>
      <div>[dashed]虚线按钮</div>
      <div class="demo-button">
        <b-button type="primary" dashed>Primary</b-button>
        <b-button type="success" dashed>Success</b-button>
        <b-button type="warning" dashed>Warning</b-button>
        <b-button type="danger" dashed>Danger</b-button>
      </div>
    </div>
  </b-config-provider>
</template>

<style scoped>
.demo-button {
  margin: 8px 0;
}
</style>
<template>
  <b-config-provider
    :theme="{
      binColorPrimary: '#722ed1',
      binColorSuccess: '#13c2c2',
      binColorWarning: '#e14c19',
      binColorDanger: '#d42a87'
    }"
  >
    <div>
      <div>[default]默认按钮</div>
      <div class="demo-button">
        <b-button type="primary">Primary</b-button>
        <b-button type="success">Success</b-button>
        <b-button type="warning">Warning</b-button>
        <b-button type="danger">Danger</b-button>
      </div>
      <div>[plain]简约按钮</div>
      <div class="demo-button">
        <b-button type="primary" plain>Primary</b-button>
        <b-button type="success" plain>Success</b-button>
        <b-button type="warning" plain>Warning</b-button>
        <b-button type="danger" plain>Danger</b-button>
      </div>
      <div>[round]圆角按钮</div>
      <div class="demo-button">
        <b-button type="primary" round>Primary</b-button>
        <b-button type="success" round>Success</b-button>
        <b-button type="warning" round>Warning</b-button>
        <b-button type="danger" round>Danger</b-button>
      </div>
      <div>[dashed]虚线按钮</div>
      <div class="demo-button">
        <b-button type="primary" dashed>Primary</b-button>
        <b-button type="success" dashed>Success</b-button>
        <b-button type="warning" dashed>Warning</b-button>
        <b-button type="danger" dashed>Danger</b-button>
      </div>
    </div>
  </b-config-provider>
</template>

<style scoped>
.demo-button {
  margin: 8px 0;
}
</style>

主题编辑器

正在开发中...