main.js 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  1. // #ifndef VUE3
  2. import Vue from 'vue'
  3. import App from './App'
  4. import navBar from '@/components/navBar/index.vue'
  5. Vue.component('navBar', navBar)
  6. import popup from '@/components/popup/index.vue'
  7. Vue.component('dpopup', popup)
  8. import uView from '@/uni_modules/uview-ui'
  9. Vue.use(uView)
  10. import store from 'store/index.js'
  11. Vue.prototype.$store = store
  12. // console.log('uploadUrl----', uploadUrl);
  13. import uploadUrl from '@/common/config.js'
  14. Vue.prototype.$picUrl = uploadUrl.picUrl
  15. Vue.prototype.$picBase = uploadUrl.picBase
  16. Vue.prototype.$appId = uploadUrl.appId
  17. Vue.prototype.$shareType = uploadUrl.shareModel
  18. Vue.prototype.$getCutDown = () => {
  19. if (uni.getStorageSync('switchs')[0]) {
  20. return 1
  21. } else if (uni.getStorageSync('switchs')[1]) {
  22. return uni.getStorageSync('priceConfig').member_price
  23. } else if (uni.getStorageSync('switchs')[2]) {
  24. return uni.getStorageSync('priceConfig').vip_price
  25. }
  26. }
  27. // 常见功能函数封装
  28. Vue.prototype.$toast = (title, icon = "none", duration = 1500) => {
  29. uni.showToast({
  30. title,
  31. icon,
  32. duration
  33. })
  34. }
  35. // 引入请求封装
  36. require('./utils/request/index')(app)
  37. Vue.config.productionTip = false
  38. App.mpType = 'app'
  39. const app = new Vue({
  40. ...App
  41. })
  42. app.$mount()
  43. // #endif
  44. // #ifdef VUE3
  45. import {
  46. createSSRApp
  47. } from 'vue'
  48. import App from './App.vue'
  49. export function createApp() {
  50. const app = createSSRApp(App)
  51. return {
  52. app
  53. }
  54. }
  55. // #endif