main.js 853 B

12345678910111213141516171819202122232425
  1. import Vue from 'vue'
  2. import App from '@/App'
  3. import $store from '@/store'
  4. Vue.prototype.$store = $store // vuex
  5. Vue.prototype.$offset = function (selector) { // 获取元素宽高位置信息
  6. return new Promise((resolve, reject) => {
  7. uni.createSelectorQuery().in(this).select(selector).boundingClientRect(data => {
  8. data ? data.x = data.left + data.width / 2 : ''
  9. data ? data.y = data.top + data.height / 2 : ''
  10. data ? resolve(data) : reject('元素不存在')
  11. }).exec()
  12. })
  13. }
  14. import CustomNav from './components/public/custom-nav.vue' //自定义头部导航栏交互组件
  15. Vue.component('custom-nav', CustomNav) //注册自定义头部导航栏
  16. import * as filters from '@/filters'
  17. Object.keys(filters).forEach(e => {
  18. Vue.filter(e, filters[e])
  19. })
  20. App.mpType ='app'
  21. Vue.config.productionTip = false
  22. ;( new Vue( { ...App } ) ).$mount()