hookehuyr

feat(PointsCollector): 重构积分收集组件并添加一键收取功能

- 重构积分收集组件布局和样式
- 实现一键收取功能并优化收集动画
- 移除冗余代码并提升性能
- 添加组件高度可配置属性
This diff is collapsed. Click to expand it.
...@@ -2,9 +2,9 @@ ...@@ -2,9 +2,9 @@
2 * index页面样式 2 * index页面样式
3 */ 3 */
4 .index { 4 .index {
5 - padding: 20px; 5 + // padding: 20px;
6 - 6 +
7 .nut-button { 7 .nut-button {
8 margin-bottom: 20px; 8 margin-bottom: 20px;
9 } 9 }
10 -}
...\ No newline at end of file ...\ No newline at end of file
10 +}
......
1 <!-- 1 <!--
2 * @Date: 2025-06-28 10:33:00 2 * @Date: 2025-06-28 10:33:00
3 * @LastEditors: hookehuyr hookehuyr@gmail.com 3 * @LastEditors: hookehuyr hookehuyr@gmail.com
4 - * @LastEditTime: 2025-08-27 15:22:35 4 + * @LastEditTime: 2025-08-27 17:13:11
5 * @FilePath: /lls_program/src/pages/index/index.vue 5 * @FilePath: /lls_program/src/pages/index/index.vue
6 * @Description: 文件描述 6 * @Description: 文件描述
7 --> 7 -->
8 <template> 8 <template>
9 <view class="index"> 9 <view class="index">
10 - <nut-button type="primary" @click="onClick">按钮</nut-button> 10 + <PointsCollector ref="pointsCollectorRef" height="30vh" />
11 - <nut-button type="success" @click="showPointsCollector" style="margin-left: 20rpx;">积分收集</nut-button> 11 + <nut-button type="success" @click="handleCollectAll" style="margin-top: 20rpx;">一键收取</nut-button>
12 - <nut-toast v-model:visible="show" msg="你成功了" />
13 - <!-- <View className="text-[#acc855] text-[100px]">Hello world!</View> -->
14 -
15 - <!-- 积分收集组件 -->
16 - <PointsCollector v-if="showCollector" />
17 </view> 12 </view>
18 </template> 13 </template>
19 14
...@@ -25,18 +20,15 @@ import { useDidShow, useReady } from '@tarojs/taro' ...@@ -25,18 +20,15 @@ import { useDidShow, useReady } from '@tarojs/taro'
25 import PointsCollector from '@/components/PointsCollector.vue' 20 import PointsCollector from '@/components/PointsCollector.vue'
26 import "./index.less"; 21 import "./index.less";
27 22
28 -const show = ref(false) 23 +const pointsCollectorRef = ref(null)
29 -const showCollector = ref(false)
30 -
31 -const onClick = () => {
32 - show.value = true
33 -}
34 24
35 /** 25 /**
36 - * 显示积分收集组件 26 + * 触发积分收集组件的一键收取
37 */ 27 */
38 -const showPointsCollector = () => { 28 +const handleCollectAll = () => {
39 - showCollector.value = !showCollector.value 29 + if (pointsCollectorRef.value) {
30 + pointsCollectorRef.value.collectAll()
31 + }
40 } 32 }
41 33
42 // 生命周期钩子 34 // 生命周期钩子
......