feat: 实现小程序分享
This commit is contained in:
@@ -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,
|
||||
|
||||
15
src/utils/share.js
Normal file
15
src/utils/share.js
Normal 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"],
|
||||
});
|
||||
}
|
||||
},
|
||||
});
|
||||
},
|
||||
};
|
||||
Reference in New Issue
Block a user