main.js 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738
  1. import Vue from 'vue'
  2. import App from '@/App'
  3. import $store from '@/store'
  4. import config from "./config.js"
  5. Vue.prototype.$config = config
  6. import uView from "uview-ui";
  7. Vue.use(uView);
  8. //配置防止连点的公共方法
  9. import common from './common/util/clicks.js'
  10. Vue.prototype.$noMultipleClicks = common.noMultipleClicks;
  11. Vue.prototype.$store = $store // vuex
  12. Vue.prototype.$offset = function(selector) { // 获取元素宽高位置信息
  13. return new Promise((resolve, reject) => {
  14. uni.createSelectorQuery().in(this).select(selector).boundingClientRect(data => {
  15. data ? data.x = data.left + data.width / 2 : ''
  16. data ? data.y = data.top + data.height / 2 : ''
  17. data ? resolve(data) : reject('元素不存在')
  18. }).exec()
  19. })
  20. }
  21. import CustomNav from './components/public/custom-nav.vue' //自定义头部导航栏交互组件
  22. Vue.component('custom-nav', CustomNav) //注册自定义头部导航栏
  23. import * as filters from '@/filters'
  24. Object.keys(filters).forEach(e => {
  25. Vue.filter(e, filters[e])
  26. })
  27. App.mpType = 'app'
  28. Vue.config.productionTip = false;
  29. (new Vue({
  30. ...App
  31. })).$mount()