main.js 640 B

123456789101112131415161718192021222324252627282930313233
  1. import App from './App'
  2. // 引入 Vant 组件
  3. import { ActionSheet, Cell, Search } from 'vant'
  4. // 引入 Vant 样式
  5. import 'vant/lib/index.css'
  6. // #ifndef VUE3
  7. import Vue from 'vue'
  8. import './uni.promisify.adaptor'
  9. Vue.config.productionTip = false
  10. App.mpType = 'app'
  11. // Vue2 环境下注册 Vant 组件
  12. Vue.use(ActionSheet)
  13. Vue.use(Cell)
  14. const app = new Vue({
  15. ...App
  16. })
  17. app.$mount()
  18. // #endif
  19. // #ifdef VUE3
  20. import { createSSRApp } from 'vue'
  21. export function createApp() {
  22. const app = createSSRApp(App)
  23. // Vue3 环境下注册 Vant 组件
  24. app.use(ActionSheet)
  25. app.use(Cell)
  26. app.use(Search)
  27. return {
  28. app
  29. }
  30. }
  31. // #endif