linjiu0505
import axios from \'axios\'
let CdnPath = {}
CdnPath.install = function (Vue, options) {
    Vue.prototype.$_cdnDomain = function () {
        if (process.env.NODE_ENV === \'production\') {
            sessionStorage.setItem(\'cdnPath\', \'https://cdn.hhhhaaaa.com\');
        } else {
            sessionStorage.setItem(\'cdnPath\', \'https://hhhh.aaaa.com.cn\');
        }
    }();
    Vue.prototype.$_cPath = function (path) {
        const reg = /^(http|ftp|https):\/\//;
        const regStatic = /^static\//;
        if (!path) {
            return \'\'
        } else {
            if (!reg.test(path)) {
                if (regStatic.test(path)) {
                    return path
                }
                let cdnDomain = sessionStorage.getItem(\'cdnPath\');
                if (cdnDomain !== null) {
                    return cdnDomain + path
                }
                return path
            }
            return path
        }
    }
}
export default CdnPath

 


分类:

技术点:

相关文章:

  • 2021-11-27
  • 2021-10-10
  • 2021-11-27
  • 2021-11-16
  • 2022-12-23
  • 2021-10-28
  • 2021-11-27
  • 2021-08-11
猜你喜欢
  • 2022-12-23
  • 2022-01-27
  • 2021-10-06
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-09-01
相关资源
相似解决方案