main.js 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  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. //全局引入iconpark图标
  9. // import { install } from '@icon-park/vue/es/all';
  10. // install(Vue, '');
  11. // Vue.use(VueRouter)
  12. //配置跳转小程序
  13. // Vue.config.ignoredElements = ['wx-open-launch-weapp'];
  14. //配置防止连点的公共方法
  15. import common from './common/util/clicks.js'
  16. Vue.prototype.$noMultipleClicks = common.noMultipleClicks;
  17. Vue.prototype.$store = $store // vuex
  18. Vue.prototype.$offset = function(selector) { // 获取元素宽高位置信息
  19. return new Promise((resolve, reject) => {
  20. uni.createSelectorQuery().in(this).select(selector).boundingClientRect(data => {
  21. console.log(data,'data')
  22. data ? data.x = data.left + data.width / 2 : ''
  23. data ? data.y = data.top + data.height / 2 : ''
  24. data ? resolve(data) : reject('元素不存在')
  25. }).exec()
  26. })
  27. }
  28. import CustomNav from './components/public/custom-nav.vue' //自定义头部导航栏交互组件
  29. Vue.component('custom-nav', CustomNav) //注册自定义头部导航栏
  30. import * as filters from '@/filters'
  31. Object.keys(filters).forEach(e => {
  32. Vue.filter(e, filters[e])
  33. })
  34. App.mpType = 'app'
  35. Vue.config.productionTip = false;
  36. (new Vue({
  37. ...App
  38. })).$mount()