爱简收旧衣按件回收前端代码仓库
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

56 lines
1.5 KiB

2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
  1. import App from './App'
  2. // import store from './store'
  3. import uView from './uni_modules/vk-uview-ui';
  4. import api from '@/api/api.js';
  5. // #ifndef VUE3
  6. import Vue from 'vue'
  7. import './uni.promisify.adaptor'
  8. Vue.config.productionTip = false
  9. App.mpType = 'app'
  10. const app = new Vue({
  11. ...App
  12. })
  13. app.$mount()
  14. // #endif
  15. // #ifdef VUE3
  16. import { createSSRApp } from 'vue';
  17. import setupGlobalProperties from './utils/index.js';
  18. export function createApp() {
  19. const app = createSSRApp(App)
  20. // 挂载全局属性和方法
  21. setupGlobalProperties(app);
  22. app.config.globalProperties.$api = api;
  23. app.use(uView);
  24. // 全局混入分享
  25. app.mixin({
  26. onShareAppMessage() {
  27. const userInfo = uni.getStorageSync('userInfo') || {};
  28. console.log('分享到朋友圈的 shareId:', userInfo); // 打印 shareId
  29. const logoName = uni.getStorageSync('logoName') || ''
  30. console.log('logoName',logoName)
  31. const logoImage = uni.getStorageSync('logoImage') || ''
  32. return {
  33. title: '欢迎体验'+(logoName),
  34. path: '/pages/index/index?shareId=' + (userInfo.shareId || ''),
  35. imageUrl: logoImage
  36. }
  37. },
  38. onShareTimeline() {
  39. const userInfo = uni.getStorageSync('userInfo') || {};
  40. console.log('分享到朋友圈的 shareId:', userInfo.shareId); // 打印 shareId
  41. return {
  42. title: '欢迎体验'+(logoName),
  43. query: 'shareId=' + (userInfo.shareId || ''),
  44. imageUrl: logoImage
  45. }
  46. }
  47. });
  48. return {
  49. app
  50. }
  51. }
  52. // #endif