feat: 新增 button 组件 border-style 属性
This commit is contained in:
parent
3f1399d1e5
commit
712a94d10c
@ -13,7 +13,7 @@ import {
|
|||||||
ButtonSize,
|
ButtonSize,
|
||||||
ButtonType,
|
ButtonType,
|
||||||
} from "./interface";
|
} from "./interface";
|
||||||
import { Boolean, BooleanOrString, String } from "../../types";
|
import { BooleanOrString, String } from "../../types";
|
||||||
|
|
||||||
export interface LayButtonProps {
|
export interface LayButtonProps {
|
||||||
type?: ButtonType;
|
type?: ButtonType;
|
||||||
@ -26,6 +26,7 @@ export interface LayButtonProps {
|
|||||||
loading?: BooleanOrString;
|
loading?: BooleanOrString;
|
||||||
disabled?: BooleanOrString;
|
disabled?: BooleanOrString;
|
||||||
nativeType?: ButtonNativeType;
|
nativeType?: ButtonNativeType;
|
||||||
|
borderStyle?: String;
|
||||||
}
|
}
|
||||||
|
|
||||||
const props = withDefaults(defineProps<LayButtonProps>(), {
|
const props = withDefaults(defineProps<LayButtonProps>(), {
|
||||||
@ -34,6 +35,7 @@ const props = withDefaults(defineProps<LayButtonProps>(), {
|
|||||||
loading: false,
|
loading: false,
|
||||||
disabled: false,
|
disabled: false,
|
||||||
nativeType: "button",
|
nativeType: "button",
|
||||||
|
borderStyle: "soild"
|
||||||
});
|
});
|
||||||
|
|
||||||
const emit = defineEmits(["click"]);
|
const emit = defineEmits(["click"]);
|
||||||
@ -44,6 +46,12 @@ const onClick = (event: any) => {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const styles = computed(() => {
|
||||||
|
return {
|
||||||
|
border: `1px ${props.borderStyle}`
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
const classes = computed(() => {
|
const classes = computed(() => {
|
||||||
return [
|
return [
|
||||||
{
|
{
|
||||||
@ -62,6 +70,7 @@ const classes = computed(() => {
|
|||||||
<button
|
<button
|
||||||
class="layui-btn"
|
class="layui-btn"
|
||||||
:class="classes"
|
:class="classes"
|
||||||
|
:style="styles"
|
||||||
:type="nativeType"
|
:type="nativeType"
|
||||||
@click="onClick"
|
@click="onClick"
|
||||||
>
|
>
|
||||||
@ -73,4 +82,4 @@ const classes = computed(() => {
|
|||||||
<slot v-else></slot>
|
<slot v-else></slot>
|
||||||
<i v-if="suffixIcon" :class="`layui-icon ${suffixIcon}`"></i>
|
<i v-if="suffixIcon" :class="`layui-icon ${suffixIcon}`"></i>
|
||||||
</button>
|
</button>
|
||||||
</template>
|
</template>
|
@ -61,6 +61,33 @@ export default {
|
|||||||
|
|
||||||
:::
|
:::
|
||||||
|
|
||||||
|
::: title 次要按钮
|
||||||
|
:::
|
||||||
|
|
||||||
|
::: demo 使用 `border-style` 属性设置边框样式
|
||||||
|
|
||||||
|
<template>
|
||||||
|
<lay-button border-style="dashed">原始按钮</lay-button>
|
||||||
|
<lay-button border="green" border-style="dashed">默认按钮</lay-button>
|
||||||
|
<lay-button border="blue" border-style="dashed">百搭按钮</lay-button>
|
||||||
|
<lay-button border="orange" border-style="dashed">暖色按钮</lay-button>
|
||||||
|
<lay-button border="red" border-style="dashed">警告按钮</lay-button>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
import { ref } from 'vue'
|
||||||
|
|
||||||
|
export default {
|
||||||
|
setup() {
|
||||||
|
|
||||||
|
return {
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
:::
|
||||||
|
|
||||||
::: title 按钮尺寸
|
::: title 按钮尺寸
|
||||||
:::
|
:::
|
||||||
|
|
||||||
@ -300,6 +327,7 @@ export default {
|
|||||||
| fluid | 最大化 | boolean | `false` | `true` `false` |
|
| fluid | 最大化 | boolean | `false` | `true` `false` |
|
||||||
| radius | 圆角 | boolean | `false` | `true` `false` |
|
| radius | 圆角 | boolean | `false` | `true` `false` |
|
||||||
| border | 边框 | string | `green` | `green` `blue` `orange` `red` |
|
| border | 边框 | string | `green` | `green` `blue` `orange` `red` |
|
||||||
|
| border-style | 边框样式 | string | `soild` | `soild` `dashed` `dotted` |
|
||||||
| disabled | 禁用 | boolean | `false` | `true` `false` |
|
| disabled | 禁用 | boolean | `false` | `true` `false` |
|
||||||
| loading | 加载 | boolean | `false` | `true` `false` |
|
| loading | 加载 | boolean | `false` | `true` `false` |
|
||||||
| native-type | 原生类型 | string | `button` | `button` `submit` `reset` |
|
| native-type | 原生类型 | string | `button` | `button` `submit` `reset` |
|
||||||
|
@ -16,6 +16,7 @@
|
|||||||
<li>
|
<li>
|
||||||
<h3>1.0.2 <span class="layui-badge-rim">2022-04-07</span></h3>
|
<h3>1.0.2 <span class="layui-badge-rim">2022-04-07</span></h3>
|
||||||
<ul>
|
<ul>
|
||||||
|
<li>[新增] button 组件 border-style 属性, 允许自定义边框样式。(by @就眠儀式)</li>
|
||||||
<li>[新增] config-provider 组件 dark-partial 属性, 夜间主题偏好配置。(by @就眠儀式)</li>
|
<li>[新增] config-provider 组件 dark-partial 属性, 夜间主题偏好配置。(by @就眠儀式)</li>
|
||||||
<li>[修复] page 组件 pages 属性为单数时, 页码计算错误。(by @就眠儀式)</li>
|
<li>[修复] page 组件 pages 属性为单数时, 页码计算错误。(by @就眠儀式)</li>
|
||||||
<li>[修复] panel 组件 background-color 为透明的问题。(by @就眠儀式)</li>
|
<li>[修复] panel 组件 background-color 为透明的问题。(by @就眠儀式)</li>
|
||||||
|
Loading…
Reference in New Issue
Block a user