1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
<template>
<i-button class="app-button" :type="type" :size="size" :disabled="disabled" @click="handleClick">
<i v-if="showIcon" :class="{[iconClass ? iconClass : '']: true, 'app-button__icon': true}"></i>
<span v-if="showCaption" class="app-button__caption">
{{caption}}
</span>
</i-button>
</template>
<script lang="ts">
import { Component, Vue, Prop } from 'vue-property-decorator'
@Component({
})
export default class AppButton extends Vue {
/**
* 按钮类型
*
* @type {string}
* @memberof AppButton
*/
@Prop({ default: 'default' }) public type!: "default" | "primary" | "dashed" | "text" | "info" | "success" | "warning" | "error";
/**
* 按钮大小
*
* @type {string}
* @memberof AppButton
*/
@Prop({ default: 'default' }) public size!: 'large' | 'small' | 'default';
/**
* 按钮禁用
*
* @type {boolean}
* @memberof AppButton
*/
@Prop({ default: false }) public disabled!: boolean;
/**
* 按钮图标
*
* @type {string}
* @memberof AppButton
*/
@Prop() public iconClass?: string;
/**
* 按钮标题
*
* @type {string}
* @memberof AppButton
*/
@Prop() public caption?: string;
/**
* 显示图标
*
* @type {boolean}
* @memberof AppButton
*/
@Prop({ default: true }) public showIcon!: boolean;
/**
* 显示标题
*
* @type {boolean}
* @memberof AppButton
*/
@Prop({ default: true }) public showCaption!: boolean;
/**
* 处理按钮点击
*
* @prama
* @memberof AppButton
*/
public handleClick($event: MouseEvent) {
this.$emit('click', $event);
}
}
</script>
<style lang='scss'>
@import "./app-button.scss";
</style>