From 8dd9360a0e4cfd22ea9e261bec3821eff3f57fe8 Mon Sep 17 00:00:00 2001
From: cloudroam <cloudroam>
Date: 星期二, 12 八月 2025 10:10:07 +0800
Subject: [PATCH] add:分享功能
---
sub-pages/hot-city/index.vue | 26 ++++++++++++++++++++++++--
1 files changed, 24 insertions(+), 2 deletions(-)
diff --git a/sub-pages/hot-city/index.vue b/sub-pages/hot-city/index.vue
index 3de6160..5d5fb2b 100644
--- a/sub-pages/hot-city/index.vue
+++ b/sub-pages/hot-city/index.vue
@@ -16,7 +16,7 @@
</view>
<!-- 标签切换部分 -->
- <up-tabs :list="tabList" @click="click">
+ <up-tabs :key="currentTab" :list="tabList" @click="click" :current="currentTabIndex">
<template #right>
<view style="padding-left: 4px;" @tap="() => showToast('插槽被点击')">
<up-icon name="list" size="40rpx" bold></up-icon>
@@ -158,7 +158,9 @@
}
return cities
})
-
+const currentTabIndex = computed(() => {
+ return tabList.value.findIndex(tab => tab.value === currentTab.value)
+})
// 标签点击事件
// const click = (item: { name: string; value: string }) => {
// currentTab.value = item.value
@@ -315,6 +317,26 @@
$message.showToast("获取洲数据失败")
}
}
+
+defineExpose({
+ onShareAppMessage() {
+ return {
+ title: '影视地标推荐',
+ path: '/pages/home/home',
+ imageUrl: '', // 可以设置默认分享图片
+ desc: '发现全球影视拍摄地,探索电影背后的故事'
+ }
+ },
+ // 分享到朋友圈
+ onShareTimeline() {
+ return {
+ title: '影视地标推荐',
+ query: '',
+ imageUrl: '', // 可以设置默认分享图片
+ desc: '发现全球影视拍摄地,探索电影背后的故事'
+ }
+ }
+})
</script>
<style scoped>
--
Gitblit v1.9.3