123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125 |
- <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.setPx(this.width),
- height: this.setPx(this.height),
- margin: this.setPx(this.gutter)
- }
- },
- boxStyleName () {
- return {
- backgroundColor: this.color,
- backgroundImage: `url('${this.background}')`,
- }
- }
- }
- }
- </script>
- <style lang="scss" scoped>
- .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>
|