|
@@ -0,0 +1,71 @@
|
|
|
+<template>
|
|
|
+ <div class="container">
|
|
|
+ <div class="content">
|
|
|
+ <img
|
|
|
+ class="animate__animated"
|
|
|
+ :class="{animate__fadeInDown: inited ? item[2] : true}"
|
|
|
+ v-for="(item, index) in items"
|
|
|
+ :key="index"
|
|
|
+ @mouseenter="mouseenter(index)"
|
|
|
+ :style="{width: item[3] + 'px', top: item[0] + 'px', left: item[1] + 'px', 'animation-delay': (!inited ? (index * 0.3) + 's' : '0s')}"
|
|
|
+ :src="require(`./images/${index + 1}.png`)"
|
|
|
+ />
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+</template>
|
|
|
+<script>
|
|
|
+const items = [
|
|
|
+ [50, 50, false, 421],
|
|
|
+ [120, 220, false, 466],
|
|
|
+ [180, -100, false, 581],
|
|
|
+ [260, -15, false, 520],
|
|
|
+ [340, 190, false, 519],
|
|
|
+]
|
|
|
+export default {
|
|
|
+ name: 'safe',
|
|
|
+ data() {
|
|
|
+ return {
|
|
|
+ items,
|
|
|
+ inited: false,
|
|
|
+ }
|
|
|
+ },
|
|
|
+ mounted() {
|
|
|
+ let timer = null
|
|
|
+ timer = setTimeout(() => {
|
|
|
+ this.inited = true
|
|
|
+ clearTimeout(timer)
|
|
|
+ }, 2500)
|
|
|
+ },
|
|
|
+ methods: {
|
|
|
+ mouseenter(index) {
|
|
|
+ let timer = null
|
|
|
+ const _items = [...this.items]
|
|
|
+ _items[index][2] = true
|
|
|
+ this.items = _items
|
|
|
+ setTimeout(() => {
|
|
|
+ this.mouseleave(index)
|
|
|
+ clearTimeout(timer)
|
|
|
+ }, 600)
|
|
|
+ },
|
|
|
+ mouseleave(index) {
|
|
|
+ const _items = [...this.items]
|
|
|
+ _items[index][2] = false
|
|
|
+ this.items = _items
|
|
|
+ }
|
|
|
+ }
|
|
|
+}
|
|
|
+</script>
|
|
|
+<style lang="less" scoped>
|
|
|
+ .container{
|
|
|
+ min-height: 500px;
|
|
|
+ .content{
|
|
|
+ width: 581px;
|
|
|
+ margin: 50px auto;
|
|
|
+ position: relative;
|
|
|
+ >img{
|
|
|
+ display: block;
|
|
|
+ position: absolute;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+</style>
|