vue3版本 TS + setup语法糖
main.ts中mixin了全局分享
import type { App } from 'vue';
// #ifdef MP-WEIXIN
import { globalOnShareAppMessage } from './mp-share';
// #endif
export const setupMixin = (app : App) => {
// #ifdef MP-WEIXIN
app.mixin(globalOnShareAppMessage);
// #endif
}
const { VUE_APP_NAME } = process.env;
export const globalOnShareAppMessage = {
onShareAppMessage(){
console.log("mixin的onShareAppMessage")
const share = {
title: VUE_APP_NAME,
path: '/pages/index',
imageUrl: '/static/logo.png'
};
return share;
}
}
当局部的onShareAppMessage再次使用的时候 执行在mixin之前,如何让局部的方法覆盖mixin呢?