button.vue
720 Bytes
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
<template>
<button class="button" :class="nativeType" @click="handleClick" :type="nativeType">
<slot></slot>
</button>
</template>
<script>
export default {
name: 'Button',
props: {
nativeType: {
type: String,
default: 'cx'
},
},
methods: {
handleClick (evt) {
this.$emit('click', evt);
}
}
};
</script>
<style scoped lang="scss">
.button {
width: 80px; //适配4字按钮样式
height: 32px;
color: #ffffff;
margin: 0 5px;
}
.cx {
background: url('../../../image/btn.png') no-repeat -4px -40px;
}
.cz {
background: url('../../../image/btn.png') no-repeat -4px -4px;
}
.sb {
background: url('../../../image/btn.png') no-repeat -4px -112px;
}
</style>