|
@@ -3,12 +3,12 @@
|
3
|
3
|
<div class="content">
|
4
|
4
|
<div class="header-img">
|
5
|
5
|
<img src="/images/bk1/pg2/header.png" alt="">
|
6
|
|
- <div id="flower" class="flower" />
|
|
6
|
+ <div ref="flowerRef" class="flower" />
|
7
|
7
|
</div>
|
8
|
8
|
<br>
|
9
|
9
|
<img class="badge-img" src="/images/bk1/pg2/badge.png" alt="">
|
10
|
10
|
|
11
|
|
- <p class="txt animate__animated animate__rubberBand">
|
|
11
|
+ <p class="txt animate__animated animate__fadeIn">
|
12
|
12
|
2014年,<br>
|
13
|
13
|
南京广电集团以“紫金草”为原型,<br>
|
14
|
14
|
制作紫金草徽章发放给市民。<br>
|
|
@@ -24,35 +24,35 @@
|
24
|
24
|
</template>
|
25
|
25
|
|
26
|
26
|
<script setup>
|
27
|
|
- import { onMounted } from 'vue';
|
|
27
|
+ import { computed, onMounted, ref } from 'vue';
|
28
|
28
|
import Dot from './Dot.vue';
|
29
|
29
|
import FlipIcon from './FlipIcon.vue';
|
30
|
30
|
import useSerial from './useSerial';
|
31
|
31
|
|
32
|
|
- const flowerImg = {
|
33
|
|
- maxHeight: 11200,
|
34
|
|
- height: 700,
|
35
|
|
- renderHeight: 150,
|
36
|
|
- percent: 150 / 700,
|
37
|
|
- }
|
|
32
|
+ const props = defineProps({
|
|
33
|
+ active: Boolean,
|
|
34
|
+ });
|
|
35
|
+
|
|
36
|
+ const flowerRef = ref();
|
|
37
|
+ const ready = computed(() => props.active);
|
38
|
38
|
|
39
|
|
- onMounted(() => {
|
|
39
|
+ console.log('-----<>', ready);
|
|
40
|
+
|
|
41
|
+ useSerial((t) => {
|
40
|
42
|
const maxHeight = 11200;
|
41
|
43
|
const rawHeight = 700;
|
42
|
|
- const flower = document.querySelector('#flower');
|
|
44
|
+ const flower = flowerRef.value;
|
43
|
45
|
const height = flower.offsetHeight;
|
|
46
|
+ const pos = t * rawHeight;
|
44
|
47
|
|
45
|
|
- useSerial((t) => {
|
46
|
|
- const pos = t * flowerImg.height;
|
|
48
|
+ const backgroundPosition = `0 -${pos * height / rawHeight}px`;
|
|
49
|
+ flower.style.backgroundPosition = backgroundPosition;
|
47
|
50
|
|
48
|
|
- const backgroundPosition = `0 -${pos * height / rawHeight}px`;
|
49
|
|
- flower.style.backgroundPosition = backgroundPosition;
|
|
51
|
+ if (pos >= (maxHeight - rawHeight)) {
|
|
52
|
+ return true;
|
|
53
|
+ }
|
|
54
|
+ }, ready);
|
50
|
55
|
|
51
|
|
- if (pos >= (maxHeight - rawHeight)) {
|
52
|
|
- return true;
|
53
|
|
- }
|
54
|
|
- })
|
55
|
|
- });
|
56
|
56
|
</script>
|
57
|
57
|
|
58
|
58
|
<style lang="less" scoped>
|