From ccddda9131c6a3018aa593708490be22f97175bc Mon Sep 17 00:00:00 2001 From: yanzai Date: Fri, 6 Sep 2024 15:29:03 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E5=88=86=E4=BA=AB=EF=BC=8C?= =?UTF-8?q?=E9=9A=90=E8=97=8F=E4=BB=B7=E6=A0=BC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- 秦皇岛四院小程序/lu/share.js | 26 ++++++++++++++++++++++++ 秦皇岛四院小程序/main.js | 2 ++ 秦皇岛四院小程序/pages/buy/info/info.vue | 4 ++-- 3 files changed, 30 insertions(+), 2 deletions(-) create mode 100644 秦皇岛四院小程序/lu/share.js diff --git a/秦皇岛四院小程序/lu/share.js b/秦皇岛四院小程序/lu/share.js new file mode 100644 index 0000000..9e515a7 --- /dev/null +++ b/秦皇岛四院小程序/lu/share.js @@ -0,0 +1,26 @@ +export default { + data() { + return {} + }, + //分享小程序 + onShareAppMessage(e) { + if (e.from === 'button') { + console.log('来自页面内转发按钮'); + } else if (e.from === 'menu') { + console.log('右上角菜单转发按钮'); + } + return { + // 自定义分享内容 + title: '大庆普济', + path: '/pages/main/home/home', // 路径,可传递参数到指定页面 + + }; + }, + // 分享到朋友圈 + onShareTimeline() { + return { + title: '大庆普济', + path: '/pages/main/home/home', + }; + }, +} diff --git a/秦皇岛四院小程序/main.js b/秦皇岛四院小程序/main.js index 04ab6c3..336ef03 100644 --- a/秦皇岛四院小程序/main.js +++ b/秦皇岛四院小程序/main.js @@ -4,10 +4,12 @@ import { import * as Pinia from 'pinia'; import App from './App.vue' import $lu from './lu' +import share from './lu/share.js' //注意路径是上一步新建文件的路径 uni.$lu = $lu export function createApp() { const app = createSSRApp(App) + app.mixin(share) app.use(Pinia.createPinia()) return { app, diff --git a/秦皇岛四院小程序/pages/buy/info/info.vue b/秦皇岛四院小程序/pages/buy/info/info.vue index 13b4dc0..3cde5c1 100644 --- a/秦皇岛四院小程序/pages/buy/info/info.vue +++ b/秦皇岛四院小程序/pages/buy/info/info.vue @@ -201,7 +201,7 @@ {{ k+1 }}.{{ i.name }} - ¥{{ Number(i.price).toFixed(2) }} + @@ -218,7 +218,7 @@ {{ k+1 }}.{{ i.name }} - ¥{{ Number(i.price).toFixed(2) }} +