u
This commit is contained in:
1 parent
b24015fbae
commit
6d4f1ee402
19 files changed
+782
-108
No files matched your search
@@ -1,3 +1,4 @@
|
||||
import type { PropType } from 'vue'
|
||||
import { computed, defineComponent } from 'vue'
|
||||
import { getPrefixCls } from '../_utils/getPrefixCls'
|
||||
import Icon from '../icon'
|
||||
@@ -19,6 +20,7 @@ export default defineComponent({
|
||||
iconPosition: { type: String as () => 'left' | 'right', default: 'left' },
|
||||
size: { type: String as () => 'small' | 'medium' | 'large', default: 'medium' },
|
||||
block: { type: Boolean, default: false },
|
||||
onClick: { type: Function as PropType<(event: MouseEvent) => void> }, // 注意这里不要加 ?
|
||||
},
|
||||
setup(props, { slots }) {
|
||||
const prefixCls = getPrefixCls('btn')
|
||||
@@ -39,7 +41,11 @@ export default defineComponent({
|
||||
|
||||
return () => {
|
||||
return (
|
||||
<button class={cls.value} disabled={props.disabled || props.loading}>
|
||||
<button
|
||||
class={cls.value}
|
||||
disabled={props.disabled || props.loading}
|
||||
onClick={props.onClick}
|
||||
>
|
||||
{props.iconPosition === 'left' && (props.loading || props.icon) && (
|
||||
<Icon
|
||||
icon={props.loading ? 'mingcute:loading-line' : props.icon}
|
||||
|
||||
Reference in new issue
Block a user