global-api.js 552 B

12345678910111213141516171819202122232425
  1. import {
  2. showLoading,
  3. closeLoading
  4. } from '@/utils/pop'
  5. export function injectGlobalApi (Vue) {
  6. Vue.config.productionTip = false
  7. Vue.config.errorHandler = err => {
  8. closeLoading()
  9. throw err
  10. }
  11. Vue.prototype.__PLACEHOLDER__ = __PLACEHOLDER__
  12. Vue.prototype.__WECHAT__ = __WECHAT__
  13. Vue.prototype.$showLoading = showLoading
  14. Vue.prototype.$closeLoading = closeLoading
  15. Vue.prototype.$designProgram = function (id) {
  16. window.open(this.$router.resolve({
  17. name: 'program',
  18. params: { id }
  19. }).href, '_blank')
  20. }
  21. }