index.vue
2.76 KB
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
<!--
* @Date: 2025-09-03 14:34:58
* @LastEditors: hookehuyr hookehuyr@gmail.com
* @LastEditTime: 2025-09-08 11:50:44
* @FilePath: /lls_program/src/components/ShareButton/index.vue
* @Description: 文件描述
-->
<!--
* @Description: 分享按钮组件 - 点击后弹出分享选项
-->
<template>
<view class="share-button-container">
<!-- 分享活动按钮 -->
<button id="share" data-name="shareBtn" open-type="share" class="share-button share-activity-btn">
分享活动
</button>
<!-- 分享海报按钮 -->
<view @tap="handleSharePoster" class="share-button share-poster-btn">
分享海报
</view>
</view>
</template>
<script setup>
import { ref } from 'vue'
import Taro from '@tarojs/taro'
// 组件属性
const props = defineProps({
// 活动数据
activityData: {
type: Object,
default: () => ({})
}
})
// 组件事件
const emit = defineEmits(['shareActivity', 'sharePoster'])
/**
* 处理海报分享
*/
const handleSharePoster = () => {
emit('sharePoster', props.activityData)
}
</script>
<style lang="less">
.share-button-container {
position: fixed;
top: 40rpx;
right: 40rpx;
z-index: 1000;
display: flex;
flex-direction: column;
gap: 28rpx;
align-items: center;
}
.share-button {
// 重置所有默认样式 - 使用!important强制覆盖
margin: 0 !important;
padding: 0 !important;
border: none !important;
outline: none !important;
background: none !important;
font: inherit !important;
position: relative !important;
display: inline-block !important;
// 应用自定义样式
color: white !important;
padding: 12rpx 20rpx !important;
border-radius: 32rpx !important;
background: rgba(0, 0, 0, 0.6) !important;
display: flex !important;
align-items: center !important;
justify-content: center !important;
box-shadow: 0 4rpx 12rpx rgba(0, 0, 0, 0.2) !important;
transition: all 0.3s ease !important;
backdrop-filter: blur(10rpx) !important;
font-size: 24rpx !important;
width: 140rpx !important;
height: 60rpx !important;
white-space: nowrap !important;
flex-shrink: 0 !important;
box-sizing: border-box !important;
line-height: normal !important;
text-align: center !important;
&:active {
transform: scale(0.95) !important;
background: rgba(0, 0, 0, 0.8) !important;
}
// 去除微信小程序button的默认样式
&::after {
border: none !important;
content: none !important;
}
// 去除button默认的点击效果
&.button-hover {
background: rgba(0, 0, 0, 0.8) !important;
}
}
.share-activity-btn {
background: rgba(74, 144, 226, 0.9);
&:active {
background: rgba(74, 144, 226, 1);
}
}
.share-poster-btn {
background: rgba(52, 199, 89, 0.9);
&:active {
background: rgba(52, 199, 89, 1);
}
}
</style>