import Vue from 'vue'
import Fingerprint2 from 'fingerprintjs2'

const deviceCode = () => {
  const localCode = window.localStorage.getItem('deviceCode')
  if(localCode !== undefined && localCode !== null && localCode !== ''){
    return localCode
  }else{
    new Fingerprint2().get(function(result, components) {
      window.localStorage.setItem('deviceCode', result)
      return result
    })
  }
}

Vue.$deviceCode = Vue.prototype.$deviceCode = deviceCode

  意义