main.js 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. import App from './App'
  2. // #ifndef VUE3
  3. import Vue from 'vue'
  4. Vue.config.productionTip = false
  5. App.mpType = 'app'
  6. const app = new Vue({
  7. ...App
  8. })
  9. app.$mount()
  10. // #endif
  11. import uView from '@/uni_modules/uview-ui'
  12. import toast from'@/components/toast/index.js'
  13. import * as http from './common/http.js'
  14. import * as utils from './common/utils.js'
  15. import * as checks from './common/check.js'
  16. import config from './config.js'
  17. import store from './store'
  18. import storage from 'common/storage'
  19. import moment from 'moment'
  20. Vue.prototype.$toast = toast
  21. Vue.prototype.$config = config
  22. Vue.prototype.$http = http
  23. Vue.prototype.$utils = utils
  24. Vue.prototype.$checks = checks
  25. Vue.prototype.$store = store
  26. Vue.prototype.$storage = storage
  27. Vue.prototype.$moment = moment
  28. Vue.prototype.$bus = new Vue()
  29. Vue.use(uView)
  30. // #ifdef VUE3
  31. import { createSSRApp } from 'vue'
  32. export function createApp() {
  33. const app = createSSRApp(App)
  34. return {
  35. app
  36. }
  37. }
  38. // #endif
  39. // 调用setConfig方法,方法内部会进行对象属性深度合并,可以放心嵌套配置
  40. // 需要在Vue.use(uView)之后执行
  41. uni.$u.setConfig({
  42. // 修改$u.config对象的属性
  43. config: {
  44. // 修改默认单位为rpx,相当于执行 uni.$u.config.unit = 'rpx'
  45. unit: 'rpx'
  46. },
  47. // 修改$u.props对象的属性
  48. props: {
  49. // 修改radio组件的size参数的默认值,相当于执行 uni.$u.props.radio.size = 30
  50. radio: {
  51. size: 15
  52. }
  53. // 其他组件属性配置
  54. // ......
  55. }
  56. })