main.js 1.32 KB
/*
 * @Descripttion:
 * @version: 1.0.0
 * @Author: limin
 * @Date: 2021-08-13 14:12:11
 * @LastEditors: limin
 * @LastEditTime: 2021-09-24 10:41:31
 * @FilePath: \scrm\scrm-sub-blog\src\main.js
 */
import Vue from 'vue'
import apis from './api'
import './public-path'
import '@/assets/css/public.scss'
import '@/filter'
// import 'glsx-components/dist/glsx-components.css'
import { start } from '@/setup'
Vue.config.productionTip = false
Vue.prototype.$apis = apis
Vue.directive('preventReClick', {
  bind: (el, binding) => {
    let time = binding.value // 防抖时间
    if (!time) {
      // 用户若不设置防抖时间,则默认1s
      time = 1000
    }
    let fun
    el.addEventListener(
      'click',
      event => {
        if (!fun) {
          // 第一次执行
          fun = setTimeout(() => {
            fun = null
          }, time)
        } else {
          // 直接取消当前事件
          event && event.stopImmediatePropagation()
        }
      },
      true
    )
  }
})
start()
export { bootstrap, mount, unmount } from '@/setup'
export const http = params => Vue.prototype.$http(params)
export const http_brand = params => Vue.prototype.$http_brand(params)
export const http_common = params => Vue.prototype.$http_common(params)
export const request_merchant = params => Vue.prototype.$request_merchant(params)