vue 全局 js 方法

1、新增 getCurrentDataType.js 文件

 

import cookieUtils from '@/config/cookieUtils'

function getCurrentDataType () {
  let type = cookieUtils.get('curr_sjjc_data_type')
  if (type === '0' || type === '1') {
    return type
  }
  return '0'
}

export { getCurrentDataType }

 

 

2. 在main.js 中设置

 

import { getCurrentDataType } from '@/utils/getCurrentDataType.js'

.
.
.
.
.
.

Vue.prototype.$getCurrentDataType = getCurrentDataType

 

posted @ 2019-12-12 14:33  漫步CODE人生  阅读(2871)  评论(0编辑  收藏  举报