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
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
| <template>
| <div class="basic-block" :style="styleName">
| <div class="box" :style="boxStyleName">
| <router-link :to="to">
| <span v-text="text"></span>
| <p v-text="dept"></p>
| <i :class="icon"></i>
| </router-link>
| </div>
| </div>
| </template>
|
| <script>
| export default {
| name: 'basicBlock',
| props: {
| icon: {
| type: String,
| },
| background: {
| type: String,
| },
| to: {
| type: Object,
| default: () => {
| return {};
| },
| },
| text: {
| type: String,
| },
| dept: {
| type: String,
| },
| time: {
| type: [Number, String],
| },
| gutter: {
| type: [Number, String],
| default: 5,
| },
| color: {
| type: String,
| },
| width: {
| type: [Number, String],
| },
| height: {
| type: [Number, String],
| },
| },
| computed: {
| styleName() {
| return {
| animationDelay: `${this.time / 25}s`,
| width: `${this.width}px`,
| height: `${this.height}px`,
| margin: `${this.gutter}px`,
| };
| },
| boxStyleName() {
| return {
| backgroundColor: this.color,
| backgroundImage: `url('${this.background}')`,
| };
| },
| },
| };
| </script>
|
| <style lang="scss">
| .basic-block {
| opacity: 0;
|
| box-sizing: border-box;
| color: #fff;
| animation: mymove 1s;
| animation-fill-mode: forwards;
|
| .box {
| position: relative;
| box-sizing: border-box;
| padding: 15px;
| width: 100%;
| height: 100%;
| transition: all 1s;
| background-size: cover;
|
| &:hover {
| transform: rotateY(360deg);
| }
| }
|
| a {
| color: #fff;
| }
|
| span {
| display: block;
| font-size: 16px;
| }
|
| p {
| width: 80%;
| font-size: 10px;
| color: #eee;
| line-height: 22px;
| }
|
| i {
| position: absolute;
| bottom: 15px;
| right: 15px;
| font-size: 50px !important;
| }
|
| @keyframes mymove {
| from {
| opacity: 0;
| transform: scale(0);
| }
| to {
| opacity: 1;
| transform: scale(1);
| }
| }
| }
| </style>
|
|