npm
Posted lw5116
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了npm相关的知识,希望对你有一定的参考价值。
/** * 设置axios的全局的header,用于项目中的axios的封装文件 * @param {axios对象} axiosObj */ function setEncryptHeader(axiosObj){ if(!axiosObj){ return; } let isEncrypt = getEncryptStorage(); if(typeof isEncrypt == ‘boolean‘){ axiosObj.defaults.headers.common[‘is-Encrypt‘] = isEncrypt;//设置全局的axios头部 } } /** * 设置storage的isEncrypt * @param {是否加密的布尔值} bool */ function setEncryptStorage(bool){ console.log(bool) sessionStorage.setItem(‘isEncrypt‘,bool);//设置sessionStorage的isEncrypt; } function getEncryptStorage(){ let isEncrypt = sessionStorage.getItem(‘isEncrypt‘)?JSON.parse(sessionStorage.getItem(‘isEncrypt‘)):null; //从sessionStorage中取isEncrypt; return isEncrypt; } const sfEncrypt = { setEncryptHeader: setEncryptHeader, setEncryptStorage: setEncryptStorage, getEncryptStorage: getEncryptStorage } module.exports = sfEncrypt; /* exports.sfEncrypt = { setEncryptHeader: setEncryptHeader, setEncryptStorage: setEncryptStorage, getEncryptStorage: getEncryptStorage }; */
以上是关于npm的主要内容,如果未能解决你的问题,请参考以下文章
Error: Python executable “H:devpython3.10python.EXE“ is v3.10.0, which is not supported by gyp.(代码片段