!22 支持直接使用icon属性配置按钮图标

Merge pull request !22 from 鄢鹏权/N/A
This commit is contained in:
就眠儀式 2022-01-26 08:30:53 +00:00 committed by Gitee
commit 52595132ad
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F

View File

@ -17,6 +17,7 @@ export interface LayButtonProps {
disabled?: boolean | string;
loading?: boolean | string;
nativeType?: "button" | "submit" | "reset";
icon?: string;
}
const props = withDefaults(defineProps<LayButtonProps>(), {
@ -25,6 +26,7 @@ const props = withDefaults(defineProps<LayButtonProps>(), {
loading: false,
disabled: false,
nativeType: "button",
icon: "",
});
const emit = defineEmits(["click"]);
@ -58,6 +60,7 @@ const classes = computed(() => {
:type="nativeType"
@click="onClick"
>
<i v-if="icon" :class="'layui-icon ' + icon"></i>
<i
v-if="loading"
class="layui-icon layui-icon-loading-one layui-anim layui-anim-rotate layui-anim-loop"