import axios from 'axios' let CdnPath = {} CdnPath.install = function (Vue, options) { Vue.prototype.$_cdnDomain = function () { if (process.env.NODE_... ...
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