码迷,mamicode.com
首页 > Web开发 > 详细

vue 全局 js 方法

时间:2019-12-12 14:48:29      阅读:84      评论:0      收藏:0      [点我收藏+]

标签:cookie   nbsp   get   code   turn   config   全局   color   rom   

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

 

vue 全局 js 方法

标签:cookie   nbsp   get   code   turn   config   全局   color   rom   

原文地址:https://www.cnblogs.com/scode2/p/12029019.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!