main.js 749 B

123456789101112131415161718192021222324252627282930313233
  1. import Vue from 'vue'
  2. import App from './App'
  3. Vue.config.productionTip = false
  4. import config from "./config.js"
  5. Vue.prototype.$config = config
  6. import uView from "uview-ui";
  7. Vue.use(uView);
  8. App.mpType = 'app'
  9. Vue.prototype.$offset = function(selector) { // 获取元素宽高位置信息
  10. return new Promise((resolve, reject) => {
  11. uni.createSelectorQuery().in(this).select(selector).boundingClientRect(data => {
  12. data ? data.x = data.left + data.width / 2 : ''
  13. data ? data.y = data.top + data.height / 2 : ''
  14. // data ? resolve(data) : reject('元素不存在')
  15. }).exec()
  16. })
  17. }
  18. import * as filters from '@/filters'
  19. Object.keys(filters).forEach(e => {
  20. Vue.filter(e, filters[e])
  21. })
  22. const app = new Vue({
  23. ...App
  24. })
  25. app.$mount()