feat: 新增 button 组件 border-style 属性

This commit is contained in:
就眠儀式
2022-04-09 02:01:06 +08:00
parent 3f1399d1e5
commit 712a94d10c
3 changed files with 40 additions and 2 deletions

View File

@@ -13,7 +13,7 @@ import {
ButtonSize,
ButtonType,
} from "./interface";
import { Boolean, BooleanOrString, String } from "../../types";
import { BooleanOrString, String } from "../../types";
export interface LayButtonProps {
type?: ButtonType;
@@ -26,6 +26,7 @@ export interface LayButtonProps {
loading?: BooleanOrString;
disabled?: BooleanOrString;
nativeType?: ButtonNativeType;
borderStyle?: String;
}
const props = withDefaults(defineProps<LayButtonProps>(), {
@@ -34,6 +35,7 @@ const props = withDefaults(defineProps<LayButtonProps>(), {
loading: false,
disabled: false,
nativeType: "button",
borderStyle: "soild"
});
const emit = defineEmits(["click"]);
@@ -44,6 +46,12 @@ const onClick = (event: any) => {
}
};
const styles = computed(() => {
return {
border: `1px ${props.borderStyle}`
}
})
const classes = computed(() => {
return [
{
@@ -62,6 +70,7 @@ const classes = computed(() => {
<button
class="layui-btn"
:class="classes"
:style="styles"
:type="nativeType"
@click="onClick"
>
@@ -73,4 +82,4 @@ const classes = computed(() => {
<slot v-else></slot>
<i v-if="suffixIcon" :class="`layui-icon ${suffixIcon}`"></i>
</button>
</template>
</template>