2021-11-16 03:30:29 +00:00
|
|
|
<script lang="ts">
|
|
|
|
export default {
|
|
|
|
name: "LayButton",
|
|
|
|
};
|
|
|
|
</script>
|
|
|
|
|
|
|
|
<script setup lang="ts">
|
|
|
|
import "./index.less";
|
2021-11-16 14:32:45 +00:00
|
|
|
import { computed } from "vue";
|
2021-11-16 03:30:29 +00:00
|
|
|
|
|
|
|
export interface LayButtonProps {
|
2021-11-16 14:32:45 +00:00
|
|
|
type?: "primary" | "normal" | "warm" | "danger";
|
|
|
|
size?: "lg" | "sm" | "xs";
|
|
|
|
fluid?: boolean;
|
|
|
|
radius?: boolean;
|
|
|
|
border?: "green" | "blue" | "orange" | "red" | "black";
|
|
|
|
disabled?: boolean;
|
|
|
|
loading?: boolean;
|
|
|
|
nativeType?: "button" | "submit" | "reset";
|
2021-11-16 03:30:29 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
const props = withDefaults(defineProps<LayButtonProps>(), {
|
|
|
|
fluid: false,
|
|
|
|
radius: false,
|
|
|
|
disabled: false,
|
|
|
|
loading: false,
|
|
|
|
nativeType: "button",
|
|
|
|
});
|
|
|
|
|
|
|
|
const classes = computed(() => {
|
|
|
|
return [
|
2021-11-16 14:32:45 +00:00
|
|
|
props.type ? `layui-btn-${props.type}` : "",
|
|
|
|
props.size ? `layui-btn-${props.size}` : "",
|
|
|
|
props.border ? `layui-border-${props.border}` : "",
|
|
|
|
];
|
|
|
|
});
|
2021-11-16 03:30:29 +00:00
|
|
|
</script>
|
|
|
|
|
2021-09-26 22:09:33 +00:00
|
|
|
<template>
|
2021-09-27 03:27:36 +00:00
|
|
|
<button
|
|
|
|
class="layui-btn"
|
2021-09-29 09:22:33 +00:00
|
|
|
:class="[
|
2021-11-16 03:30:29 +00:00
|
|
|
{
|
2021-11-16 14:32:45 +00:00
|
|
|
'layui-btn-fluid': fluid,
|
|
|
|
'layui-btn-radius': radius,
|
|
|
|
'layui-btn-disabled': disabled
|
2021-11-16 03:30:29 +00:00
|
|
|
},
|
2021-11-16 14:32:45 +00:00
|
|
|
classes,
|
2021-09-29 09:22:33 +00:00
|
|
|
]"
|
2021-10-19 14:36:09 +00:00
|
|
|
:type="nativeType"
|
2021-09-27 03:27:36 +00:00
|
|
|
>
|
2021-10-16 15:41:35 +00:00
|
|
|
<i
|
|
|
|
v-if="loading"
|
|
|
|
class="
|
|
|
|
layui-icon
|
|
|
|
layui-icon-loading-1
|
|
|
|
layui-anim
|
|
|
|
layui-anim-rotate
|
|
|
|
layui-anim-loop
|
|
|
|
"
|
|
|
|
></i>
|
|
|
|
<slot v-else />
|
2021-09-27 03:27:36 +00:00
|
|
|
</button>
|
2021-11-16 03:30:29 +00:00
|
|
|
</template>
|