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
88
89
90
91
92
93
94
95
96
97
98
| <!-- -->
| <template>
| <div class="btn_box" @click="btn_click">
| <div class="btn_bg1" :style="`background-image:url(${currentimg})`">
| <div :class="`icon iconfont ${icon}`"></div>
| </div>
| <div class="title">{{title}}</div>
| </div>
| </template>
|
| <script>
| import defaultimg from "@/assets/images/btn_bg1.png";
| import activeimg from "@/assets/images/btn_bg1_active.png";
| export default {
| name: "yBtn",
| components: {},
| props: {
| title: {
| type: String,
| default: "按钮",
| },
| icon: {
| type: String,
| default: "iconpointer",
| },
| active: {
| type: Boolean,
| default: false,
| },
| ischecked: {
| type: Boolean,
| default: false,
| },
| },
| data() {
| return {};
| },
| created() {},
| mounted() {
| // console.log(this.active, 27);
| },
| computed: {
| currentimg() {
| let resimg = defaultimg
| if(this.ischecked){
| resimg = this.active ? activeimg : defaultimg
| }
| return resimg;
| },
| checked(){
| return this.active
| }
| },
| watch: {},
| methods: {
| btn_click(){
| this.$emit('click')
| }
| },
| };
| </script>
| <style scoped>
| .btn_box {
| width: 100px;
| height: 90px;
| cursor: pointer;
| position: relative;
| display: inline-block;
| }
|
| .btn_box .title {
| height: 30px;
| line-height: 30px;
| text-align: center;
| color: #fff;
| font-size: 18px;
| margin-top: -10px;
| }
| .btn_box .btn_bg1 {
| width: 100%;
| height: 70px;
| background-image: url("../assets/images/btn_bg1.png");
| background-repeat: no-repeat;
| background-size: 100% 100%;
| }
| .btn_box .btn_bg1 .icon {
| height: 40px;
| position: absolute;
| left: 30px;
| top: 5px;
| width: 40px;
| font-size: 40px;
| color: aquamarine;
| }
| .btn_box:hover .btn_bg1 .icon{
| color: #fff;
| }
| </style>
|
|