1.常用数据布尔值判断
const data = ['',0,-1,null,undefined,[],{},()=>{}]
data.forEach(item=>{
if(item){
console.log(item,'结果')
}
打印结果:''、0、null、undefined这四个值的布尔值都是false,其余都是true
2.vue项目请求更改协议https
方法一
直接在index.html中添加下面代码,请求就会都变成https
<meta http-equiv="Content-Security-Policy" content="upgrade-insecure-requests">
方法二
好像仅适用于开发环境
直接在vue.config.js中的devServer里面开启 https:true
vue3是vite.config.js中的server开启 https:true