feat: 实现小程序分享

This commit is contained in:
2025-10-13 20:04:05 +08:00
parent 2abce21c49
commit 621d5d4c57
2 changed files with 17 additions and 0 deletions

View File

@@ -1,4 +1,5 @@
import App from "./App"; import App from "./App";
import share from "./utils/share";
// #ifndef VUE3 // #ifndef VUE3
import Vue from "vue"; import Vue from "vue";
@@ -21,6 +22,7 @@ export function createApp() {
pinia.use(createUnistorage()); pinia.use(createUnistorage());
app.use(pinia); app.use(pinia);
app.use(share);
return { return {
app, app,

15
src/utils/share.js Normal file
View File

@@ -0,0 +1,15 @@
export default {
install(app) {
app.mixin({
onLoad() {
const page = getCurrentPages().pop();
if (page) {
uni.showShareMenu({
withShareTicket: true,
menus: ["shareAppMessage", "shareTimeline"],
});
}
},
});
},
};