feat: 设置分享转发

This commit is contained in:
hackrobot
2024-03-19 14:52:06 +08:00
parent 0084774d48
commit 8eacec835c
3 changed files with 28 additions and 3 deletions

View File

@@ -18,6 +18,7 @@ export default defineConfig(async (merge, { command, mode }) => {
640: 2.34 / 2,
750: 1,
375: 2,
// 375: 2/1,
828: 1.81 / 2
},
sourceRoot: 'src',

View File

@@ -1,3 +1,3 @@
export default definePageConfig({
navigationBarTitleText: '首页'
navigationBarTitleText: '数字游民'
})

View File

@@ -1,10 +1,11 @@
import { View, Text, Image } from "@tarojs/components";
import { useLoad } from "@tarojs/taro";
import Taro from "@tarojs/taro";
import { AtAvatar, AtTag, AtIcon, AtTabBar } from "taro-ui";
import "./index.scss";
import beijing from "@/images/city/beijing.jpg";
import { VIEW } from "@tarojs/runtime";
import { useEffect } from "react";
// import beijing from "../../images/city/beijing.jpg";
export default function Index() {
@@ -12,6 +13,30 @@ export default function Index() {
console.log("Page loaded.");
});
useEffect(() => {
// 更新分享
Taro.updateShareMenu({
withShareTicket: true,
success() {},
});
// 显示分享按钮
Taro.showShareMenu({
withShareTicket: true,
// showShareItems:true,
});
// 打开分享图片弹窗,可以将图片发送给朋友、收藏或下载
Taro.downloadFile({
url: "https://res.wx.qq.com/wxdoc/dist/assets/img/demo.ef5c5bef.jpg",
success: (res) => {
Taro.showShareImageMenu({
path: res.tempFilePath,
});
},
});
}, []);
const HomeCardItem = () => {
return [1, 2, 3].map((item, index) => {
return (
@@ -68,7 +93,6 @@ export default function Index() {
<HomeCardItem />
</View>
{/* 底部tabbar */}
<View className="tabbbar">
<AtTabBar