diff --git a/src/main.js b/src/main.js index 9143fc7..aac440f 100644 --- a/src/main.js +++ b/src/main.js @@ -1,4 +1,5 @@ import App from "./App"; +import share from "./utils/share"; // #ifndef VUE3 import Vue from "vue"; @@ -21,6 +22,7 @@ export function createApp() { pinia.use(createUnistorage()); app.use(pinia); + app.use(share); return { app, diff --git a/src/utils/share.js b/src/utils/share.js new file mode 100644 index 0000000..620e316 --- /dev/null +++ b/src/utils/share.js @@ -0,0 +1,15 @@ +export default { + install(app) { + app.mixin({ + onLoad() { + const page = getCurrentPages().pop(); + if (page) { + uni.showShareMenu({ + withShareTicket: true, + menus: ["shareAppMessage", "shareTimeline"], + }); + } + }, + }); + }, +};