Skip to content
Merged
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
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,24 @@
&.hover {
box-shadow: none !important;
}

.source {
.demo-spacing {
& > * {
margin: 0 8px 8px 0;

&:last-child {
margin-right: 0;
}
}

&:last-child {
& > * {
margin-bottom: 0;
}
}
}
}
}

.demo-block-control {
Expand Down
23 changes: 16 additions & 7 deletions packages/devui-vue/docs/.vitepress/devui-theme/styles/layout.scss
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,10 @@ h5,
h6 {
margin: 0;
line-height: 1.25;

&:focus {
outline: none;
}
}

h1,
Expand Down Expand Up @@ -88,7 +92,6 @@ h2 {
padding-bottom: 0.3rem;
line-height: 1.25;
font-size: 1.65rem;
/* overflow-x: auto; */
}

h2 + h3 {
Expand All @@ -101,6 +104,7 @@ h3 {
}

h4 {
margin-top: 2rem;
font-size: 1.15rem;
}

Expand Down Expand Up @@ -195,7 +199,7 @@ blockquote {
border-left: 0.2rem solid $devui-dividing-line;
padding: 0.25rem 0 0.25rem 1rem;
font-size: 1rem;
color: #999;
color: #999999;
}

blockquote > p {
Expand Down Expand Up @@ -269,22 +273,27 @@ $max-width: 1440px;
}
}

[ui-theme=infinity-theme], [ui-theme=galaxy-theme] {
[ui-theme=infinity-theme],
[ui-theme=galaxy-theme] {
.nav-bar {
background-color: $devui-base-bg !important;
}
}

[ui-theme=sweet-theme], [ui-theme=provence-theme], [ui-theme=deep-theme] {
[ui-theme=sweet-theme],
[ui-theme=provence-theme],
[ui-theme=deep-theme] {
.nav-bar {
background-color: $devui-brand !important;

a {
color: #fff !important;
color: #ffffff !important;
}

svg, path, polygon {
fill: #fff !important;
svg,
path,
polygon {
fill: #ffffff !important;
}
}
}
130 changes: 46 additions & 84 deletions packages/devui-vue/docs/components/button/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,45 +2,45 @@

按钮用于开始一个即时操作。

### 何时使用
#### 何时使用

标记了一个(或封装一组)操作命令,响应用户点击行为,触发相应的业务逻辑。

### 按钮类型
### 形态

:::demo 通过`variant`设置按钮类型,目前支持`solid`、`outline`、`text`三种类型,默认为`outline`类型
:::demo 通过`variant`设置按钮形态,目前支持`solid`、`outline`、`text`三种形态,默认为`outline`。

```vue
<template>
<div class="button-size-demo">
<div class="demo-spacing">
<d-button variant="solid">Solid Button</d-button>
<d-button>Outline Button</d-button>
<d-button variant="text">Text Button</d-button>
</div>
</template>

<style>
.button-size-demo > button {
margin-right: 8px;
}
</style>
```

:::

### 主题色

:::demo 通过`color`设置按钮主题,目前支持`secondary`、`primary`、`danger`三种类型,默认为`secondary`类型
:::demo 通过`color`设置按钮的主题色,目前支持`primary`、`secondary`、`danger`三种主题色,默认为`secondary`。<br>注意:如果`variant`设置成`solid`,则默认使用`primary`主题色

```vue
<template>
<div class="button-size-demo">
<div class="demo-spacing">
<d-button variant="solid" color="primary">Primary</d-button>
<d-button color="primary">Primary</d-button>
<d-button variant="text" color="primary">Primary</d-button>
</div>
<br />
<div class="button-size-demo">

<div class="demo-spacing">
<d-button variant="solid" color="secondary">Secondary</d-button>
<d-button color="secondary">Secondary</d-button>
<d-button variant="text" color="secondary">Secondary</d-button>
</div>

<div class="demo-spacing">
<d-button variant="solid" color="danger">Danger</d-button>
<d-button color="danger">Danger</d-button>
<d-button variant="text" color="danger">Danger</d-button>
Expand All @@ -50,36 +50,36 @@

:::

### 按钮大小
### 尺寸

:::demo 通过`size`设置按钮大小,支持`xs`、`sm`、`md`、`lg`四种类型,默认为`md`。
:::demo 通过`size`设置按钮尺寸,支持`xs`、`sm`、`md`、`lg`四种类型的尺寸,默认为`md`。

```vue
<template>
<div class="button-size-demo">
<div class="demo-spacing">
<d-button size="xs">Mini</d-button>
<d-button size="sm">Small</d-button>
<d-button>Middle</d-button>
<d-button>Medium</d-button>
<d-button size="lg">Large</d-button>
</div>
</template>
```

:::

### 禁用按钮
### 禁用状态

:::demo 通过`disabled`参数设置按钮禁用状态。

```vue
<template>
<div class="button-size-demo">
<div class="demo-spacing">
<d-button variant="solid">Solid Button</d-button>
<d-button>Outline Button</d-button>
<d-button variant="text">Text Button</d-button>
</div>
<br />
<div class="button-size-demo">

<div class="demo-spacing">
<d-button variant="solid" disabled>Solid Button</d-button>
<d-button disabled>Outline Button</d-button>
<d-button variant="text" disabled>Text Button</d-button>
Expand All @@ -95,15 +95,18 @@

```vue
<template>
<d-button variant="solid" color="primary" :loading="showLoading" @click="handleClick">Click Me</d-button>
<d-button variant="solid" :loading="showLoading" @click="handleClick">Click Me</d-button>
</template>
<script>
import { ref, onBeforeUnmount } from 'vue';

export default {
setup() {
const showLoading = ref(false);

const handleClick = () => {
showLoading.value = true;

setTimeout(() => {
showLoading.value = false;
}, 2000);
Expand All @@ -117,92 +120,51 @@ export default {

:::

### 图标
### 图标按钮

:::demo

```vue
<template>
<div class="button-size-demo">
<d-button icon="add" variant="solid" color="primary">New</d-button>
<div class="demo-spacing">
<d-button icon="add" variant="solid">New</d-button>
<d-button icon="filter">Filter</d-button>
</div>
<br />
<div class="button-size-demo">
<d-button icon="add" variant="solid" color="primary" disabled>New(disabled)</d-button>
<d-button icon="filter" disabled>Filter(disabled)</d-button>
</div>
<br />
<div class="button-size-demo">
<d-button icon="connect" variant="text">Link</d-button>
<d-button icon="run" variant="text">Run</d-button>
</div>
<br />
<div class="button-size-demo">
<d-button icon="connect" variant="text" disabled>Link(disabled)</d-button>
<d-button icon="run" variant="text" disabled>Run(disabled)</d-button>
</div>
<br />
<div class="button-size-demo">
<d-button icon="add" variant="text" title="add"></d-button>
<d-button icon="delete" variant="text" title="delete"></d-button>
</div>
<br />
<div class="button-size-demo">
<d-button icon="add" variant="text" disabled title="add"></d-button>
<d-button icon="delete" variant="text" disabled title="delete"></d-button>
</div>
<br />
<div class="button-size-demo">
<d-button size="xs">
Click me
<span class="icon-chevron-down"></span>
</d-button>
</div>
<br />
<div class="button-size-demo">
<d-button variant="text">
Click me
<span class="icon-chevron-down"></span>
</d-button>
<d-button icon="delete" variant="text" title="Delete"></d-button>
</div>
</template>
<style>
.icon-chevron-down {
display: inline-block;
vertical-align: middle;
position: relative;
top: -0.1em;
}
</style>
```

:::

### d-button 参数
### Button 参数

| 参数 | 类型 | 默认 | 说明 | 跳转 Demo |
| -------- | --------------------------------- | ----------- | --------------------- | ------------------------- |
| variant | [IButtonVariant](#ibuttonvariant) | 'outline' | 可选,按钮形态 | [形态](#形态) |
| color | [IButtonColor](#ibuttoncolor) | 'secondary' | 可选,按钮主题 | [主题色](#主题色) |
| size | [IButtonSize](#ibuttonsize) | 'md' | 可选,按钮尺寸 | [尺寸](#尺寸) |
| icon | `string` | -- | 可选,自定义按钮图标 | [图标按钮](#图标按钮) |
| disabled | `boolean` | false | 可选,是否禁用 button | [禁用状态](#禁用状态) |
| loading | `boolean` | false | 可选,设置加载中状态 | [加载中状态](#加载中状态) |

### 类型

| 参数 | 类型 | 默认 | 说明 | 跳转 Demo |
| -------- | ---------------- | ----------- | --------------------- | ------------------------- |
| variant | `IButtonVariant` | 'outline' | 可选,按钮的形态 | [按钮类型](#按钮类型) |
| color | `IButtonColor` | 'secondary' | 可选,按钮主题 | [主题色](#主题色) |
| size | `IButtonSize` | 'md' | 可选,按钮大小 | [按钮大小](#按钮大小) |
| icon | `string` | -- | 可选,自定义按钮图标 | [图标](#图标) |
| disabled | `boolean` | false | 可选,是否禁用 button | [禁用按钮](#禁用按钮) |
| loading | `boolean` | false | 可选,设置加载中状态 | [加载中状态](#加载中状态) |
<br>

### IButtonVariant 类型
#### IButtonVariant

```typescript
type IButtonVariant = 'solid' | 'outline' | 'text';
```

### IButtonSize 类型
#### IButtonSize

```typescript
type IButtonSize = 'lg' | 'md' | 'sm' | 'xs';
```

### IButtonColor 类型
#### IButtonColor

```typescript
type IButtonColor = 'secondary' | 'primary' | 'danger';
Expand Down
Loading