
获得徽章 0
- 各大网站全站灰色方式,使用了css filter grayscale实现
grayscale:灰度值,1代表100%灰色
掘金:
html.gray-mode {
filter: grayscale(.95);
-webkit-filter: grayscale(.95);
}
知乎:
html {
-webkit-filter: grayscale(1);
filter: grayscale(1);
}展开赞过13 - vue,当开启hash模式的时候,window.location.search获取不到参数,这时需要使用window.location.hash来获取参数
兼容hash模式与非hash模式的方法:
function getSearch() {
return window.location.search || window.location.search.substr(1) || window.location.hash.split("?")[1];
}展开评论点赞 - vscode中使用终端启动前端项目后,一直会自动生成newrelice_agent.log,贼恶心。
解决方法,排查下来,发现是new relice codestream扩展插件导致的,去到打开vscode扩展插件目录,删除codestream.codestream-xxx,然后重新启动vscode就好了,后面启动项目再也不会生成日志文件等人赞过评论5 - // 比较日期是否在同一天
function isSameDay(timeA, timeB) {
// 获取两个时间的0点时间戳
let dateA = new Date(timeA + '').setHours(0, 0, 0, 0)
let dateB = new Date(timeB + '').setHours(0, 0, 0, 0)
// 比较时间戳
return dateA === dateB
}
const t1 = '2022-03-23 17:32'
const t2 = '2022-03-23 08:11'
console.log(isSameDay(t1, t2))展开赞过42 app.netlify.com 部署网页到网上,提供二级域名,比github page更加灵活
1、使用github账户授权登录app.netlify.com
2、创建site
3、管理github的某个代码仓库
4、开始部署
5、部署成功后,修改site name,让站点名字友好一点(比如vue2-vueuse-example.netlify.app)
展开赞过12- 命令行模式下node-sass安装错误,使用sass代替
解决方法:
npm i node-sass@npm:sass
sass有一个编译好的版本名为**dart-sass(**现已更名为sass),它有着完全的跨平台兼容性,因为它已经给你编译好了。为了避免库依赖的其他问题,我们最好不要改它的名字,只要改它的内在就可以了。
让它保持node-sass的引用而实际上装的为dart-sass了。展开等人赞过17 - uniapp打包小程序后,未找到 sitemap解决方法
解决方法:
1、在 dist/dev/mp-weixin 目录下新建名为 sitemap.json 的文件
2、然后填写如下内容就可以了,这个文件新建后除非直接删除 dist 文件夹,不然后续的代码更新不会影响到这个文件:
{
"rules": [{
"action": "allow",
"page": "*"
}]
}展开评论点赞