forked from N3-components/N3-components
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathn3Button.vue
65 lines (62 loc) · 1.27 KB
/
n3Button.vue
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
<template>
<a :class="classObj">
<slot></slot>
<n3-loading v-if="loading" size="xs" style="position:relative;top:2px"></n3-loading>
<n3-badge v-if="badge">{{badge}}</n3-badge>
</a>
</template>
<script>
import n3Loading from './n3Loading'
import n3Badge from './n3Badge'
export default{
props: {
size: {
type: String
},
type: {
type: String,
default: 'default'
},
badge: {
type: [String, Number]
},
active: {
type: Boolean,
default: false
},
disabled: {
type: Boolean,
default: false
},
block: {
type: Boolean,
default: false
},
loading: {
type: Boolean,
default: false
},
prefixCls: {
type: String,
default: 'n3'
}
},
computed: {
classObj () {
let {prefixCls, type, size, block, active, disabled} = this
let klass = {}
klass[prefixCls + '-btn'] = true
klass[prefixCls + '-btn-block'] = block
klass[prefixCls + '-btn-active'] = active
klass[prefixCls + '-btn-disabled'] = disabled
size ? klass[prefixCls + '-btn-' + size] = true : ''
type ? klass[prefixCls + '-btn-' + type] = true : ''
return klass
}
},
components: {
n3Loading,
n3Badge
}
}
</script>